-
Notifications
You must be signed in to change notification settings - Fork 0
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 #75 from KGU-C-Lab/develop
open-bata release
- Loading branch information
Showing
70 changed files
with
1,491 additions
and
549 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 @@ | ||
yarn commitlint --edit $1 |
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,2 @@ | ||
VITE_MODE=production | ||
VITE_API_BASE_URL=https://api.clab.page |
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
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 |
---|---|---|
@@ -1,73 +1,45 @@ | ||
import { API_BASE_URL, END_POINT } from '@constants/api'; | ||
import { PaginationType } from '@type/api'; | ||
import type { MembershipFeeType } from '@type/membershipFee'; | ||
import { createCommonPagination, createPath, getAccessToken } from '@utils/api'; | ||
import { server } from './server'; | ||
import { END_POINT } from '@constants/api'; | ||
import { createCommonPagination } from '@utils/api'; | ||
import { postUploadedFileMembershipFee } from './uploadedFile'; | ||
import type { ArgsWithFiles, BaseResponse, PaginationType } from '@type/api'; | ||
import type { MembershipFeeType } from '@type/membershipFee'; | ||
|
||
interface postMembershipFeeArgs { | ||
interface postMembershipFeeArgs extends ArgsWithFiles { | ||
body: MembershipFeeType; | ||
multipartFile?: FormData; | ||
} | ||
|
||
/** | ||
* 회비 신청 정보 조회 | ||
*/ | ||
export const getMembershipFee = async (page: number, size: number) => { | ||
const params = { page, size }; | ||
const { data } = await server.get<PaginationType<MembershipFeeType>>({ | ||
url: createCommonPagination(END_POINT.MEMBERSHIP_FEE, params), | ||
}); | ||
return data; | ||
}; | ||
|
||
/** | ||
* 회비 신청 | ||
*/ | ||
export const postMembershipFee = async ({ | ||
body, | ||
multipartFile, | ||
}: postMembershipFeeArgs) => { | ||
const accessToken = getAccessToken(); | ||
let membershipFeeData; | ||
|
||
if (multipartFile) { | ||
const storagePeriod = 7; | ||
const url = createPath(API_BASE_URL, END_POINT.UPLOADEDFILE_MEMBERSHIP_FEE); | ||
const addUrl = `${url}?storagePeriod=${storagePeriod}`; | ||
const { data: imageData } = await fetch(addUrl, { | ||
method: 'POST', | ||
headers: { | ||
Authorization: `Bearer ${accessToken}`, | ||
}, | ||
body: multipartFile, | ||
}) | ||
.then((response) => { | ||
if (!response.ok) { | ||
throw new Error('Network response was not ok'); | ||
} | ||
return response.json(); | ||
}) | ||
.catch((e) => console.error(e)); | ||
console.log('이미지 저장 완료'); | ||
const data = await postUploadedFileMembershipFee({ | ||
storagePeriod: 365, | ||
multipartFile: multipartFile, | ||
}); | ||
|
||
membershipFeeData = { | ||
...body, | ||
imageUrl: imageData[0], | ||
}; | ||
} else { | ||
membershipFeeData = body; | ||
body['imageUrl'] = data[0].fileUrl; | ||
} | ||
|
||
const { data } = await fetch( | ||
createPath(API_BASE_URL, END_POINT.MEMBERSHIP_FEE), | ||
{ | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${accessToken}`, | ||
}, | ||
body: JSON.stringify(membershipFeeData), | ||
}, | ||
).then((response) => { | ||
if (!response.ok) { | ||
throw new Error('Network response was not ok'); | ||
} | ||
return response.json(); | ||
const { data } = await server.post<MembershipFeeType, BaseResponse<number>>({ | ||
url: END_POINT.MEMBERSHIP_FEE, | ||
body: body, | ||
}); | ||
|
||
return data; | ||
}; | ||
|
||
export const getMembershipFee = async (page: number, size: number) => { | ||
const params = { page, size }; | ||
const { data } = await server.get<PaginationType<MembershipFeeType>>({ | ||
url: createCommonPagination(END_POINT.MEMBERSHIP_FEE, params), | ||
}); | ||
return data; | ||
}; |
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
Oops, something went wrong.