-
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 #229 from Team-TIFY/dev
[Deploy]: 애플 로그인 구현 배포 테스트
- Loading branch information
Showing
19 changed files
with
234 additions
and
88 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
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
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { useState, useEffect } from 'react' | ||
import { OauthCodeResponse } from '@utils/apis/auth/AuthType' | ||
import { useMutation } from '@tanstack/react-query' | ||
import { useLocation } from 'react-router-dom' | ||
import { AuthApi } from '@utils/apis/auth/AuthApi' | ||
import useAuthMutate from '@libs/hooks/useAuthMutate' | ||
import Loading from '@components/atoms/Loading' | ||
|
||
export const AppleRedirect = () => { | ||
const [token, setToken] = useState<OauthCodeResponse>({ | ||
accessToken: '', | ||
idToken: '', | ||
refreshToken: '', | ||
}) | ||
const query = useLocation().search | ||
const code = new URLSearchParams(query).get('code') | ||
|
||
const appleTokenMutation = useMutation(AuthApi.APPLE_TOKEN, { | ||
onSuccess: (data: OauthCodeResponse) => { | ||
setToken(data) | ||
}, | ||
}) | ||
|
||
const { oauthAppleValidMutation } = useAuthMutate(token) | ||
|
||
useEffect(() => { | ||
if (code) { | ||
appleTokenMutation.mutate(code) | ||
} | ||
}, [code]) | ||
|
||
useEffect(() => { | ||
if (token.idToken.length > 0) { | ||
oauthAppleValidMutation.mutate(token.idToken) | ||
} | ||
}, [token]) | ||
|
||
return ( | ||
<> | ||
<Loading /> | ||
</> | ||
) | ||
} |
Oops, something went wrong.