Fix: Middlerawe/1
This commit is contained in:
@@ -5,7 +5,7 @@ import _ from "lodash";
|
||||
import { cookies } from "next/headers";
|
||||
|
||||
export async function funCheckToken() {
|
||||
const c = cookies().get("ssn");
|
||||
const c = cookies().get("mySession");
|
||||
const cekToken = await prisma.userSession.findFirst({
|
||||
where: {
|
||||
token: c?.value,
|
||||
|
||||
@@ -4,7 +4,7 @@ import prisma from "@/app/lib/prisma";
|
||||
import { cookies } from "next/headers";
|
||||
|
||||
export async function funGetUserIdByToken() {
|
||||
const c = cookies().get("ssn");
|
||||
const c = cookies().get("mySession");
|
||||
const token = c?.value
|
||||
const cekToken = await prisma.userSession.findFirst({
|
||||
where: {
|
||||
|
||||
@@ -18,7 +18,7 @@ export async function auth_Logout() {
|
||||
if (!delToken) return { status: 400, message: "Gagal Hapus User Session" };
|
||||
|
||||
cookies().delete({
|
||||
name: "ssn",
|
||||
name: "mySession",
|
||||
});
|
||||
return { status: 200, message: "Logout Berhasil" };
|
||||
} catch (error) {
|
||||
|
||||
@@ -47,7 +47,7 @@ export async function Auth_funRegister({
|
||||
);
|
||||
|
||||
cookies().set({
|
||||
name: "ssn",
|
||||
name: "mySession",
|
||||
value: sealToken,
|
||||
maxAge: 60 * 60 * 24 * 7,
|
||||
});
|
||||
|
||||
@@ -42,7 +42,7 @@ export async function auth_funValidasi({
|
||||
);
|
||||
|
||||
cookies().set({
|
||||
name: "ssn",
|
||||
name: "mySession",
|
||||
value: sealToken,
|
||||
maxAge: 60 * 60 * 24 * 30,
|
||||
});
|
||||
|
||||
@@ -10,7 +10,7 @@ import { redirect } from "next/navigation";
|
||||
export async function user_funGetOneUserId(): Promise<string | null> {
|
||||
try {
|
||||
const kukis = cookies();
|
||||
const c = kukis.get("ssn");
|
||||
const c = kukis.get("mySession");
|
||||
if (!c || !c?.value || _.isEmpty(c?.value) || _.isUndefined(c?.value))
|
||||
return redirect(RouterAuth.login);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user