-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #58 from MARU-EGG/TSK-50
[TSK-50] api request url 변경 반영
- Loading branch information
Showing
4 changed files
with
83 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { server_axiosInstance } from '../../utils/axios'; | ||
import { getCookie } from '../../utils/cookies'; | ||
import { TypeStatusProps } from './question-type-status/change-type-status'; | ||
|
||
export interface AdmissionTypeDetailProps extends TypeStatusProps { | ||
detailTypeId: number; | ||
detailTypeName: string; | ||
} | ||
|
||
export const updateAdmissionTypeDetail = async ({ detailTypeId, detailTypeName }: AdmissionTypeDetailProps) => { | ||
try { | ||
const response = server_axiosInstance.put( | ||
`/api/admin/admissions/${detailTypeId}`, | ||
{ | ||
detailTypeName, | ||
}, | ||
{ | ||
headers: { | ||
Authorization: `Bearer ${getCookie('accessToken')}`, | ||
}, | ||
}, | ||
); | ||
return (await response).data; | ||
} catch (error: any) { | ||
throw new Error('updated Failed', error); | ||
} | ||
}; | ||
|
||
export const deleteAdmissionTypeDetail = async ({ detailTypeId }: AdmissionTypeDetailProps) => { | ||
try { | ||
const response = server_axiosInstance.delete(`/api/admin/admission/${detailTypeId}`, { | ||
headers: { | ||
Authorization: `Bearer ${getCookie('accessToken')}`, | ||
}, | ||
}); | ||
return (await response).data; | ||
} catch (error: any) { | ||
throw new Error('Delete Failed', error); | ||
} | ||
}; | ||
|
||
export const generateAdmissionTypeDetail = async ({ type, detailTypeName }: AdmissionTypeDetailProps) => { | ||
try { | ||
const response = server_axiosInstance.put( | ||
`/api/admin/admissions/detail`, | ||
{ | ||
detail: detailTypeName, | ||
type: type, | ||
}, | ||
{ | ||
headers: { | ||
Authorization: `Bearer ${getCookie('accessToken')}`, | ||
}, | ||
}, | ||
); | ||
return (await response).data; | ||
} catch (error: any) { | ||
throw new Error('updated Failed', error); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { server_axiosInstance } from '../utils/axios'; | ||
import { TypeStatusProps } from './admin/question-type-status/change-type-status'; | ||
|
||
export const getAllDetailType = async () => { | ||
try { | ||
const response = await server_axiosInstance.get('/api/admissions/details'); | ||
return response.data; | ||
} catch (error: any) { | ||
throw new Error('get all detail type fail', error); | ||
} | ||
}; | ||
|
||
export const getDetailType = async ({ type }: TypeStatusProps) => { | ||
try { | ||
const response = await server_axiosInstance.get(`/api/admissions/detail/${type}`); | ||
return response.data; | ||
} catch (error: any) { | ||
throw new Error('get all detail type fail', error); | ||
} | ||
}; |