mirror of
https://github.com/umami-software/umami.git
synced 2026-02-21 04:55:36 +01:00
Updated redis calls.
This commit is contained in:
parent
bb5affe29a
commit
62a8b29453
9 changed files with 41 additions and 27 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import cors from 'cors';
|
||||
import debug from 'debug';
|
||||
import redis from '@umami/redis-client';
|
||||
import { getClient, redisEnabled } from '@umami/redis-client';
|
||||
import { getAuthToken, parseShareToken } from 'lib/auth';
|
||||
import { ROLES } from 'lib/constants';
|
||||
import { secret } from 'lib/crypto';
|
||||
|
|
@ -54,8 +54,10 @@ export const useAuth = createMiddleware(async (req, res, next) => {
|
|||
|
||||
if (userId) {
|
||||
user = await getUser(userId);
|
||||
} else if (redis.enabled && authKey) {
|
||||
const key = await redis.client.get(authKey);
|
||||
} else if (redisEnabled && authKey) {
|
||||
const redis = getClient();
|
||||
|
||||
const key = await redis.get(authKey);
|
||||
|
||||
if (key?.userId) {
|
||||
user = await getUser(key.userId);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue