add types back to event / pageview. fix non-redis auth

This commit is contained in:
Francis Cao 2023-03-02 12:56:38 -08:00
parent 82f0bc3d2b
commit c9cacbb0e2
3 changed files with 42 additions and 3 deletions

View file

@ -36,7 +36,13 @@ export const useAuth = createMiddleware(async (req, res, next) => {
const shareToken = await parseShareToken(req);
let user = null;
const { userId, authKey } = payload || {};
let userId = null;
const { authKey } = payload || {};
if (typeof payload === 'string') {
userId = payload;
}
if (validate(userId)) {
user = await getUser({ id: userId });