This commit is contained in:
熊潇 2025-03-02 01:56:54 +08:00
parent c482092961
commit 10600571d3
2 changed files with 4 additions and 2 deletions

View File

@ -8,7 +8,7 @@ import { domain } from '@/modules/domain.ts';
* @param ctx
* @returns
*/
const createCookie = (token: any, ctx: any) => {
export const createCookie = (token: any, ctx: any) => {
if (!domain) {
return;
}

View File

@ -6,6 +6,7 @@ import jsonwebtoken from 'jsonwebtoken';
// const tokenData: Record<string, string> = {};
import { redis } from '@/app.ts';
import { createCookie } from './me.ts';
app
.route({
@ -79,9 +80,10 @@ app
// const data = tokenData[loginToken];
const data = await redis.get(loginToken);
if (data) {
ctx.body = data;
ctx.body = { token: data, expireTime: 0 };
} else {
ctx.throw(400, 'Checked Failed');
}
createCookie(data, ctx);
})
.addTo(app);