pages updated

This commit is contained in:
2025-01-06 16:38:27 +03:00
parent 24d2169132
commit c1f517d32d
51 changed files with 1619 additions and 420 deletions

View File

@@ -3,9 +3,10 @@ export const tokenSecret = process.env.TOKENSECRET || "";
export const cookieObject: any = {
httpOnly: true,
path: "/",
sameSite: "lax",
sameSite: "none",
secure: true,
maxAge: 3600,
priority: "high",
};
interface FilterListInterface {
@@ -34,7 +35,7 @@ class FilterList {
}: FilterListInterface = {}) {
this.page = page ?? 1;
this.size = size ?? 5;
this.orderField = orderField ?? "id";
this.orderField = orderField ?? "uu_id";
this.orderType = orderType ?? "asc";
this.orderType = this.orderType.startsWith("a") ? "asc" : "desc";
this.includeJoins = includeJoins ?? [];

View File

@@ -13,7 +13,6 @@ const buildUpdateEndpoint = `${baseUrl}/building/build/update`;
async function retrieveBuildList(payload: FilterListInterface) {
const feedObject = new FilterList(payload).filter();
console.log("feedObject", feedObject);
const tokenResponse: any = await fetchDataWithToken(
buildListEndpoint,
feedObject,
@@ -41,6 +40,7 @@ async function updateBuild(payload: any) {
}
async function createBuild(payload: any) {
console.log("payload", payload);
const tokenResponse: any = await fetchDataWithToken(
buildCreateEndpoint,
payload,

View File

@@ -3,7 +3,7 @@ import { fetchData, fetchDataWithToken } from "../api-fetcher";
import { cookies } from "next/headers";
import { baseUrl, cookieObject, tokenSecret } from "../basics";
import NextCrypto from "next-crypto";
import { setAvailableEvents } from "../events/available";
// import { setAvailableEvents } from "../events/available";
const loginEndpoint = `${baseUrl}/authentication/login`;
const loginSelectEndpoint = `${baseUrl}/authentication/select`;
@@ -75,11 +75,6 @@ async function loginViaAccessKeys(payload: LoginViaAccessKeys) {
value: JSON.stringify(userProfile),
...cookieObject,
});
// cookieStore.set({
// name: "userType",
// value: userType,
// ...cookieObject,
// });
}
return tokenResponse;
}
@@ -108,7 +103,6 @@ async function loginSelectEmployee(payload: LoginSelectEmployee) {
value: usersSelection,
...cookieObject,
});
await setAvailableEvents();
}
return selectResponse;
}
@@ -143,7 +137,7 @@ async function loginSelectOccupant(payload: LoginSelectOccupant) {
value: usersSelection,
...cookieObject,
});
await setAvailableEvents();
// await setAvailableEvents();
}
return selectResponse;
}

View File

@@ -2,6 +2,7 @@
import { fetchDataWithToken } from "../api-fetcher";
import { cookies } from "next/headers";
import { baseUrl } from "../basics";
import { redirect } from "next/navigation";
const logOutEndpoint = `${baseUrl}/authentication/logout`;
const logOutAllEndpoint = `${baseUrl}/authentication/disconnect`;
@@ -11,7 +12,6 @@ interface LoginOutUser {
}
async function logoutActiveSession(payload: LoginOutUser) {
"use server";
const cookieStore = await cookies();
cookieStore.delete("accessToken");
cookieStore.delete("accessObject");
@@ -26,10 +26,7 @@ async function logoutActiveSession(payload: LoginOutUser) {
"POST",
false
);
if (tokenResponse.status === 200) {
return true;
}
return false;
return tokenResponse.status === 200 ? true : false;
}
async function logoutAllSessions(payload: LoginOutUser) {

View File

@@ -33,7 +33,7 @@ class HeadersAndValidations {
parseProcesser() {
Object.entries(this.validation).map(([key, value]) => {
this.validated[key] = {
required: !value.required,
required: value.required,
fieldType: value?.type,
};
});