Refactored queries.

This commit is contained in:
Mike Cao 2023-07-29 22:03:34 -07:00
parent f36a689817
commit 8904b7b4ed
27 changed files with 137 additions and 144 deletions

View file

@ -12,7 +12,7 @@ import { findSession } from 'lib/session';
import { getAuthToken, parseShareToken } from 'lib/auth';
import { secret, isUuid } from 'lib/crypto';
import { ROLES } from 'lib/constants';
import { getUser } from '../queries';
import { getUserById } from '../queries';
import { NextApiRequestCollect } from 'pages/api/send';
const log = debug('umami:middleware');
@ -53,7 +53,7 @@ export const useAuth = createMiddleware(async (req, res, next) => {
const { userId, authKey } = payload || {};
if (isUuid(userId)) {
user = await getUser({ id: userId });
user = await getUserById(userId);
} else if (redis.enabled && authKey) {
user = await redis.get(authKey);
}