-
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.
- Loading branch information
Showing
4 changed files
with
65 additions
and
14 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,48 @@ | ||
import { rest } from 'msw' | ||
import ApiEndPoint from '@/config/apiEndPoint' | ||
import { Environment } from '@/config/environment' | ||
|
||
const baseUrl = Environment.apiAddress() | ||
|
||
const authHandlers = [ | ||
rest.get(`${baseUrl}${ApiEndPoint.kakaoLogin()}`, async (_req, res, ctx) => { | ||
return res( | ||
ctx.status(200), | ||
ctx.text('성공했습니다.'), | ||
ctx.json({ | ||
data: { | ||
userInfo: { | ||
userId: 1, | ||
nickname: '병원에 간 미어캣', | ||
imageUrl: 'http://asdf~', | ||
}, | ||
token: { | ||
accessToken: 'asdfasdf', | ||
refreshToken: 'asdfa', | ||
}, | ||
}, | ||
}), | ||
) | ||
}), | ||
rest.get(`${baseUrl}${ApiEndPoint.googleLogin()}`, async (_req, res, ctx) => { | ||
return res( | ||
ctx.status(200), | ||
ctx.text('성공했습니다.'), | ||
ctx.json({ | ||
data: { | ||
userInfo: { | ||
userId: 1, | ||
nickname: '병원에 간 미어캣', | ||
imageUrl: 'http://asdf~', | ||
}, | ||
token: { | ||
accessToken: 'asdfasdf', | ||
refreshToken: 'asdfa', | ||
}, | ||
}, | ||
}), | ||
) | ||
}), | ||
] | ||
|
||
export default authHandlers |
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,4 @@ | ||
import authHandlers from './authHandlers' | ||
import { testHandlers } from './testHandler' | ||
|
||
export const handlers = [...testHandlers] | ||
export const handlers = [...testHandlers, ...authHandlers] |
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,15 +1,16 @@ | ||
import ApiEndPoint from '@/config/apiEndPoint' | ||
import { Environment } from '@/config/environment' | ||
|
||
const postLogin = async () => { | ||
const response = await fetch(Environment.apiAddress() + ApiEndPoint.login(), { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
}) | ||
const data = await response.json() | ||
return data | ||
import apiClient from '../apiClient' | ||
|
||
const getKakaoLogin = async () => { | ||
const response = await apiClient.get(ApiEndPoint.kakaoLogin()) | ||
|
||
return response | ||
} | ||
|
||
const getGoogleLogin = async () => { | ||
const response = await apiClient.get(ApiEndPoint.googleLogin()) | ||
|
||
return response | ||
} | ||
|
||
export { postLogin } | ||
export { getKakaoLogin, getGoogleLogin } |