Skip to content

Commit

Permalink
[#260] verify 실패 문제 해결 (#265)
Browse files Browse the repository at this point in the history
  • Loading branch information
chanwoo00106 authored Sep 7, 2023
1 parent 9d0d6f3 commit a60d2f6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
9 changes: 7 additions & 2 deletions packages/app/src/features/server/services/accessService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@ interface Response {
role: Role
}

const accessService = async () => {
const accessService = async (accessToken: string) => {
try {
const { data } = await axiosApi.get<Response>('/auth/verify/access')
const { data } = await axiosApi.get<Response>(
`${process.env.SERVER_URL}/auth/verify/access`,
{
headers: { Authorization: `Bearer ${accessToken}` },
}
)
return { isSuccess: true, data }
} catch (error) {
return { isSuccess: false, error }
Expand Down
3 changes: 2 additions & 1 deletion packages/app/src/pages/api/verify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ export default async function handler(
if (req.method !== 'GET') {
return res.status(400).json({ message: 'not found page' })
}
const accessToken = req.cookies[Token.ACCESS_TOKEN] || ''
const refreshToken = req.cookies[Token.REFRESH_TOKEN] || ''

const { isSuccess, data } = await accessService()
const { isSuccess, data } = await accessService(accessToken)
if (isSuccess) {
return res.status(200).json(data)
}
Expand Down

0 comments on commit a60d2f6

Please sign in to comment.