-
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.
Browse files
Browse the repository at this point in the history
…in-kakao 로그인, 유저 모드 api 연결 #94
- Loading branch information
Showing
8 changed files
with
114 additions
and
40 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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
const QUERY_KEYS = { | ||
LOGIN: 'login', | ||
FEED: 'feed', | ||
FOLLOW_LIST: 'followList', | ||
USER_INFO: 'userInfo', | ||
|
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,38 @@ | ||
// import { useQuery } from '@tanstack/react-query'; | ||
import { isAxiosError } from 'axios'; | ||
|
||
import fetchInstance from '../fetchInstance'; | ||
// import QUERY_KEYS from '../queryKeys'; | ||
|
||
type UserModeResponse = { role: string; userType: string }; | ||
|
||
async function getUserMode(): Promise<UserModeResponse> { | ||
try { | ||
const response = await fetchInstance().get('/users/type'); | ||
|
||
return response.data.data; // todo: dto 확인하기, 타입이 뭔지 확인 | ||
} catch (error) { | ||
if (isAxiosError(error)) { | ||
if (error.response) { | ||
throw new Error(error.response.data.message || 'user mode 가져오기 실패'); | ||
} else { | ||
throw new Error('네트워크 오류 또는 서버에 연결할 수 없습니다.'); | ||
} | ||
} else { | ||
throw new Error('알 수 없는 오류입니다.'); | ||
} | ||
} | ||
} | ||
|
||
// const useGetFollow = () => { | ||
// const { data, status, refetch } = useQuery<APIResponse<FollowResponse>, Error>({ | ||
// queryKey: [QUERY_KEYS.FOLLOW_LIST], | ||
// queryFn: getFollow, | ||
// }); | ||
|
||
// return { data, status, refetch }; | ||
// }; | ||
|
||
// export default useGetFollow; | ||
|
||
export default getUserMode; |
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,31 @@ | ||
import styled from '@emotion/styled'; | ||
|
||
import KakaoSymbol from '@/assets/kakao-symbol.svg?react'; | ||
|
||
type KakaoLoginButtonProps = { | ||
onClick: () => void; | ||
}; | ||
|
||
const KakaoLoginButton = ({ onClick }: KakaoLoginButtonProps) => { | ||
return ( | ||
<StyledKakaoLoginButton onClick={onClick}> | ||
<KakaoSymbol /> | ||
카카오로 시작하기 | ||
</StyledKakaoLoginButton> | ||
); | ||
}; | ||
|
||
export default KakaoLoginButton; | ||
|
||
const StyledKakaoLoginButton = styled.button` | ||
display: inline-flex; | ||
justify-content: center; | ||
align-items: center; | ||
margin: 0 16px; | ||
padding: 10px 50px; | ||
background-color: var(--color-yellow-kakao); | ||
border-radius: var(--border-radius); | ||
gap: 16px; | ||
font-size: var(--font-size-md); | ||
font-weight: 500; | ||
`; |
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