Fixed dashboard ordering issue. Closes #1414

This commit is contained in:
Mike Cao 2022-08-29 20:57:34 -07:00
parent d4eddaa636
commit fb39ce8822
4 changed files with 21 additions and 14 deletions

View file

@ -1,5 +1,5 @@
import { parseSecureToken, parseToken } from 'next-basics';
import { SHARE_TOKEN_HEADER } from './constants';
import { parseSecureToken, parseToken, getItem } from 'next-basics';
import { AUTH_TOKEN, SHARE_TOKEN_HEADER } from './constants';
import { getWebsiteById } from 'queries';
import { secret } from './crypto';
@ -13,6 +13,12 @@ export async function getAuthToken(req) {
}
}
export function getAuthHeader() {
const token = getItem(AUTH_TOKEN);
return token ? { authorization: `Bearer ${token}` } : {};
}
export async function isValidToken(token, validation) {
try {
const result = parseToken(token, secret());

View file

@ -1,8 +0,0 @@
import { getItem } from 'next-basics';
import { AUTH_TOKEN } from './constants';
export function getAuthHeader() {
const token = getItem(AUTH_TOKEN);
return token ? { authorization: `Bearer ${token}` } : {};
}