-
Notifications
You must be signed in to change notification settings - Fork 1
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 #56 from Beside-Potenday/seungbeom
feat: 직장인 기능 추가
- Loading branch information
Showing
18 changed files
with
705 additions
and
266 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
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,27 @@ | ||
import { useMutation } from '@tanstack/react-query'; | ||
import { mailSendBusiness, mailResponseData } from '@/types'; | ||
import { BASE_URL } from '..'; | ||
import axios from 'axios'; | ||
|
||
export const postBusinessPath = () => `${BASE_URL}/api/mails/business`; | ||
|
||
export const postBusiness = async (mailData: mailSendBusiness): Promise<mailResponseData> => { | ||
const response = await axios.post<mailResponseData>(postBusinessPath(), mailData); | ||
return response.data; | ||
}; | ||
|
||
export const usePostBusiness = () => { | ||
const { mutate: businessMutate, status: businessStatus } = useMutation< | ||
mailResponseData, | ||
Error, | ||
mailSendBusiness | ||
>({ | ||
mutationFn: postBusiness, | ||
retry: 3, | ||
onError: (error) => { | ||
console.error('API call failed:', error); | ||
}, | ||
}); | ||
|
||
return { businessMutate, businessStatus }; | ||
}; |
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,23 +1,27 @@ | ||
import { useMutation } from '@tanstack/react-query'; | ||
import { mailSend, mailResponseData } from '@/types'; | ||
import { mailSendUniv, mailResponseData } from '@/types'; | ||
import { BASE_URL } from '..'; | ||
import axios from 'axios'; | ||
|
||
export const postUnivPath = () => `${BASE_URL}/api/mails/univ`; | ||
|
||
export const postUniv = async (mailData: mailSend): Promise<mailResponseData> => { | ||
export const postUniv = async (mailData: mailSendUniv): Promise<mailResponseData> => { | ||
const response = await axios.post<mailResponseData>(postUnivPath(), mailData); | ||
return response.data; | ||
}; | ||
|
||
export const usePostUniv = () => { | ||
const mutation = useMutation<mailResponseData, Error, mailSend>({ | ||
const { mutate: univMutate, status: univStatus } = useMutation< | ||
mailResponseData, | ||
Error, | ||
mailSendUniv | ||
>({ | ||
mutationFn: postUniv, | ||
retry: 3, | ||
onError: (error) => { | ||
console.error('API call failed:', error); | ||
}, | ||
}); | ||
|
||
return mutation; | ||
return { univMutate, univStatus }; | ||
}; |
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.