Init NextJS, Implement Login and more

This commit is contained in:
2026-01-28 11:33:28 +01:00
parent a471b28121
commit 2666c5cd32
36 changed files with 7242 additions and 0 deletions

22
src/components/DAL/dal.ts Normal file
View File

@@ -0,0 +1,22 @@
'use server'
import 'server-only'
import { cookies } from 'next/headers'
import {cache} from "react";
import {sendRequestwToken} from "@/app/actions/auth";
import {TokenIsValid} from "@/app/actions/interfaces";
export const verifySession = cache(async () => {
const cookie = (await cookies()).get('token')?.value
const resp = await sendRequestwToken(`${process.env.API_ENDPOINT}/token/validate`,'GET')
if (!cookie || resp === null) {
return { isAuth: false, token: cookie }
}
const is_valid = (await (resp as Response).json()) as TokenIsValid
return { isAuth: is_valid.is_valid, token: cookie }
})