File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 1+ import useAuthStore from '@/stores/authStore' ;
12import client from './client' ;
23
34type LoginType = 'kakao' | 'naver' | 'google' ;
@@ -8,6 +9,20 @@ export const socialLogin = (loginType: LoginType) => {
89 window . location . href = `http://13.209.132.150:8081/oauth2/authorization/${ loginType } ` ;
910} ;
1011
12+ export const logout = async ( ) => {
13+ const { accessToken } = useAuthStore . getState ( ) ;
14+ try {
15+ const response = await client . post ( `/api/logout` , {
16+ Authorization : { token : `Bearer ${ accessToken } ` } ,
17+ withCredentials : true ,
18+ } ) ;
19+ if ( ! response ) throw new Error ( 'logout fail' ) ;
20+ return response ;
21+ } catch ( error ) {
22+ console . error ( error ) ;
23+ }
24+ } ;
25+
1126//임시 코드
1227export const getUserToken = async ( stateToken : string ) => {
1328 try {
You can’t perform that action at this time.
0 commit comments