Added rev_id column. Updated redis calls.

This commit is contained in:
Mike Cao 2022-11-07 16:22:49 -08:00
parent a9112f39ec
commit 3485b6268b
18 changed files with 133 additions and 79 deletions

18
pages/api/auth/logout.js Normal file
View file

@ -0,0 +1,18 @@
import { methodNotAllowed, ok } from 'next-basics';
import { useAuth } from 'lib/middleware';
import redis from 'lib/redis';
import { getAuthToken } from 'lib/auth';
export default async (req, res) => {
await useAuth(req, res);
if (req.method === 'POST') {
if (redis.enabled) {
await redis.del(`auth:${getAuthToken(req)}`);
}
return ok(res);
}
return methodNotAllowed(res);
};