generated from Team-INSERT/Repository-generator-Frontend
-
Notifications
You must be signed in to change notification settings - Fork 2
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 #162 from Team-INSERT/feat/logout
로그아웃 기능 구현
- Loading branch information
Showing
7 changed files
with
46 additions
and
25 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,9 @@ | ||
import httpClient from "@/apis/httpClient"; | ||
import Storage from "@/storage"; | ||
|
||
export const logout = async () => { | ||
const { data } = await httpClient.auth.logout({ | ||
headers: { refresh_token: Storage.getItem("TOKEN:REFRESH") }, | ||
}); | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { KEY } from "@/constants"; | ||
import Storage from "@/storage"; | ||
import { useMutation, useQueryClient } from "@tanstack/react-query"; | ||
import { logout } from "./api.service"; | ||
|
||
export const useLogoutMutation = () => { | ||
const queryClient = useQueryClient(); | ||
return useMutation(logout, { | ||
onSettled: () => { | ||
queryClient.invalidateQueries([KEY.USER]); | ||
Storage.delItem("TOKEN:ACCESS"); | ||
Storage.delItem("TOKEN:REFRESH"); | ||
}, | ||
}); | ||
}; |
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 |
---|---|---|
|
@@ -4,7 +4,10 @@ import { createGlobalStyle } from "styled-components"; | |
import { theme } from "."; | ||
|
||
const GlobalStyle = createGlobalStyle` | ||
@import url("https://cdn.jsdelivr.net/gh/orioncactus/[email protected]/dist/web/variable/pretendardvariable.min.css"); | ||
* { | ||
font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, Roboto, "Helvetica Neue", "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif; | ||
margin: 0; | ||
padding: 0; | ||
box-sizing: border-box; | ||
|