-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
59 additions
and
7 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 @@ | ||
export * from './useGetLoginStatus'; |
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,3 @@ | ||
export interface GetLoginStatusResponse { | ||
message: 'Authenticated' | 'Not Authenticated'; | ||
} |
15 changes: 15 additions & 0 deletions
15
packages/frontend/src/apis/queries/auth/useGetLoginStatus.ts
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,15 @@ | ||
import { useQuery } from '@tanstack/react-query'; | ||
import { GetLoginStatusResponse } from './types'; | ||
import { instance } from '@/apis/config'; | ||
|
||
const getLoginStatus = async (): Promise<GetLoginStatusResponse> => { | ||
const { data } = await instance.get('/api/auth/google/status'); | ||
return data; | ||
}; | ||
|
||
export const useGetLoginStatus = () => { | ||
return useQuery<GetLoginStatusResponse, Error>({ | ||
queryKey: ['login_status'], | ||
queryFn: getLoginStatus, | ||
}); | ||
}; |
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,3 +1,34 @@ | ||
import { Link } from 'react-router-dom'; | ||
import { useGetLoginStatus } from '@/apis/queries/auth'; | ||
|
||
export const MyPage = () => { | ||
return <div>마이페이지</div>; | ||
const { data: loginStatus } = useGetLoginStatus(); | ||
|
||
return ( | ||
<div> | ||
<h1 className="display-bold24 mb-16">마이페이지</h1> | ||
<article className="grid h-[40rem] grid-cols-[1.5fr_2.5fr] gap-5"> | ||
<section className="grid grid-rows-[1fr_2fr] gap-5"> | ||
<section className="display-medium20 rounded-md bg-white p-7"> | ||
{loginStatus?.message === 'Authenticated' ? ( | ||
'내정보' | ||
) : ( | ||
<Link | ||
to="/login" | ||
className="display-bold20 text-blue hover:underline" | ||
> | ||
로그인 | ||
</Link> | ||
)} | ||
</section> | ||
<section className="display-medium20 rounded-md bg-white p-7"> | ||
알림 | ||
</section> | ||
</section> | ||
<section className="display-medium20 rounded-md bg-white p-7"> | ||
주식 정보 | ||
</section> | ||
</article> | ||
</div> | ||
); | ||
}; |