feat: tambah dependensi 'jose' versi 5.9.2 pada package.json

refactor: rapikan identasi dan buat field 'expires' opsional di model UserSession pada schema prisma

chore: bersihkan import tidak terpakai di route login dan register API
This commit is contained in:
2024-09-18 14:39:39 +08:00
parent 2ccbca6566
commit 6ee43ed20f
83 changed files with 794 additions and 273 deletions

View File

@@ -1,9 +1,7 @@
import APIs from "./APIs";
import DIRECTORY_ID from "./id-derectory";
import prisma from "./prisma";
import { PwdCookies } from "./pwd";
export { DIRECTORY_ID };
export { prisma };
export { APIs };
export { PwdCookies };

View File

@@ -1,5 +0,0 @@
import "dotenv/config";
const dotenv = require("dotenv").config(".env");
const PwdCookies = dotenv?.parsed.PWD;
export { PwdCookies };

View File

@@ -2,4 +2,5 @@ export const RouterAuth = {
login: "/dev/auth/login",
validasi: "/dev/auth/validasi/",
register: "/dev/auth/register/",
check_cookies: "/dev/check-cookies",
};

15
src/app/lib/server_env.ts Normal file
View File

@@ -0,0 +1,15 @@
type ENV = {
DATABASE_URL: string;
WIBU_PWD: string;
Client_KEY: string;
Server_KEY: string;
MAPBOX_TOKEN: string;
WS_APIKEY: string;
};
export class ServerEnv {
static value: ENV | null = null;
static set(val: ENV) {
ServerEnv.value = val;
}
}

View File

@@ -10,8 +10,31 @@ class TokenStorage {
}
}
function TokenProvider({ token }: { token: string }) {
type ENV = {
DATABASE_URL: string;
WIBU_PWD: string;
Client_KEY: string;
Server_KEY: string;
MAPBOX_TOKEN: string;
WS_APIKEY: string;
};
export class GlobalEnv {
static value: ENV | null = null;
static set(val: ENV) {
GlobalEnv.value = val;
}
}
function TokenProvider({
token,
envObject,
}: {
token: string;
envObject: ENV;
}) {
TokenStorage.set(token);
GlobalEnv.set(envObject);
return null;
}