mirror of
https://github.com/umami-software/umami.git
synced 2026-02-10 07:37:11 +01:00
Updated redis calls.
This commit is contained in:
parent
4c0beaee14
commit
f7dd0464e0
9 changed files with 44 additions and 45 deletions
|
|
@ -3,13 +3,13 @@ import { useAuth } from 'lib/middleware';
|
|||
import { NextApiResponse } from 'next';
|
||||
import { badRequest, ok } from 'next-basics';
|
||||
import redis from '@umami/redis-client';
|
||||
import { setAuthKey } from 'lib/auth';
|
||||
import { saveAuth } from 'lib/auth';
|
||||
|
||||
export default async (req: NextApiRequestAuth, res: NextApiResponse) => {
|
||||
await useAuth(req, res);
|
||||
|
||||
if (redis && req.auth.user) {
|
||||
const token = await setAuthKey(req.auth.user, 86400);
|
||||
if (redis.enabled && req.auth.user) {
|
||||
const token = await saveAuth({ userId: req.auth.user.id }, 86400);
|
||||
|
||||
return ok(res, { user: req.auth.user, token });
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue