Skip to content

Commit

Permalink
fix: auth refresh token & logout
Browse files Browse the repository at this point in the history
  • Loading branch information
masb0ymas committed Nov 27, 2020
1 parent 03bc8a1 commit be1badb
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/controllers/Auth/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,13 @@ routes.post(
asyncHandler(async function authRefreshToken(req: Request, res: Response) {
const { email, refreshToken } = req.getBody()

const { accessToken, expiresIn } = await RefreshTokenService.getAccessToken(
email,
refreshToken
)
const buildResponse = BuildResponse.get({
message: 'access token has been received',
const {
accessToken,
expiresIn,
})
tokenType,
} = await RefreshTokenService.getAccessToken(email, refreshToken)

return res.status(200).json(buildResponse)
return res.status(200).json({ accessToken, expiresIn, tokenType })
})
)

Expand All @@ -82,8 +78,8 @@ routes.post(
asyncHandler(async function logout(req: Request, res: Response) {
const { UserId } = req.getBody()

await AuthService.logout(UserId)
const buildResponse = BuildResponse.deleted({})
const message = await AuthService.logout(UserId)
const buildResponse = BuildResponse.deleted({ message })

return res.status(200).json(buildResponse)
})
Expand Down

0 comments on commit be1badb

Please sign in to comment.