feat: Add ctx.state.authType for tracking (#1567)

This commit is contained in:
Tom Moor
2020-09-21 22:02:37 -07:00
committed by GitHub
parent fa96891c8e
commit 0fa8a6ed2e
3 changed files with 39 additions and 25 deletions

View File

@@ -18,7 +18,7 @@ function getJWTPayload(token) {
return payload;
}
export async function getUserForJWT(token: string) {
export async function getUserForJWT(token: string): Promise<User> {
const payload = getJWTPayload(token);
const user = await User.findByPk(payload.id);
@@ -31,7 +31,7 @@ export async function getUserForJWT(token: string) {
return user;
}
export async function getUserForEmailSigninToken(token: string) {
export async function getUserForEmailSigninToken(token: string): Promise<User> {
const payload = getJWTPayload(token);
// check the token is within it's expiration time