fix
This commit is contained in:
parent
c482092961
commit
10600571d3
@ -8,7 +8,7 @@ import { domain } from '@/modules/domain.ts';
|
|||||||
* @param ctx
|
* @param ctx
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
const createCookie = (token: any, ctx: any) => {
|
export const createCookie = (token: any, ctx: any) => {
|
||||||
if (!domain) {
|
if (!domain) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import jsonwebtoken from 'jsonwebtoken';
|
|||||||
|
|
||||||
// const tokenData: Record<string, string> = {};
|
// const tokenData: Record<string, string> = {};
|
||||||
import { redis } from '@/app.ts';
|
import { redis } from '@/app.ts';
|
||||||
|
import { createCookie } from './me.ts';
|
||||||
|
|
||||||
app
|
app
|
||||||
.route({
|
.route({
|
||||||
@ -79,9 +80,10 @@ app
|
|||||||
// const data = tokenData[loginToken];
|
// const data = tokenData[loginToken];
|
||||||
const data = await redis.get(loginToken);
|
const data = await redis.get(loginToken);
|
||||||
if (data) {
|
if (data) {
|
||||||
ctx.body = data;
|
ctx.body = { token: data, expireTime: 0 };
|
||||||
} else {
|
} else {
|
||||||
ctx.throw(400, 'Checked Failed');
|
ctx.throw(400, 'Checked Failed');
|
||||||
}
|
}
|
||||||
|
createCookie(data, ctx);
|
||||||
})
|
})
|
||||||
.addTo(app);
|
.addTo(app);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user