Added missing async for loginWithCredentials

This commit is contained in:
RemixDev 2021-05-23 21:30:51 +02:00
parent 47559071d6
commit 08aefdce77

View File

@ -3,15 +3,16 @@ import { getAccessToken, getArlFromAccessToken } from '../../../main'
const path = '/loginWithCredentials' const path = '/loginWithCredentials'
const handler: ApiHandler['handler'] = (req, res) => { const handler: ApiHandler['handler'] = async (req, res) => {
const { username, password } = req.body const { username, password } = req.body
let accessToken = req.body.accessToken let accessToken = req.body.accessToken
if (!accessToken){ if (!accessToken){
const accessToken = getAccessToken(username, password) const accessToken = await getAccessToken(username, password)
console.log({ accessToken }) console.log({ accessToken })
} }
const arl = getArlFromAccessToken(accessToken) let arl
if (accessToken) arl = getArlFromAccessToken(accessToken)
console.log({ username, password }) console.log({ username, password })
res.send({ accessToken, arl }) res.send({ accessToken, arl })