Buildin Page tested
This commit is contained in:
@@ -39,7 +39,6 @@ class FilterList {
|
||||
this.orderType = this.orderType.startsWith("a") ? "asc" : "desc";
|
||||
this.includeJoins = includeJoins ?? [];
|
||||
this.query = query ?? {};
|
||||
|
||||
}
|
||||
filter() {
|
||||
return {
|
||||
|
||||
@@ -13,6 +13,7 @@ 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,
|
||||
|
||||
22
apicalls/checkEndpoint.tsx
Normal file
22
apicalls/checkEndpoint.tsx
Normal file
@@ -0,0 +1,22 @@
|
||||
"use server";
|
||||
import { fetchDataWithToken } from "./api-fetcher";
|
||||
import { baseUrl } from "./basics";
|
||||
|
||||
const accessAvailableEndpoint = `${baseUrl}/access/endpoint/available`;
|
||||
|
||||
async function retrieveAvailableEndpoint(payload: string) {
|
||||
const tokenResponse: any = await fetchDataWithToken(
|
||||
accessAvailableEndpoint,
|
||||
{
|
||||
endpoint: payload,
|
||||
},
|
||||
"POST",
|
||||
false
|
||||
);
|
||||
if (tokenResponse.status === 200) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export { retrieveAvailableEndpoint };
|
||||
@@ -105,7 +105,9 @@ async function retrieveUserSelection() {
|
||||
const avatarInfo = await retrieveAvatarInfo();
|
||||
return {
|
||||
...objectUserSelection,
|
||||
lang: String(avatarInfo?.data?.lang).toLowerCase(),
|
||||
lang: avatarInfo?.data?.lang
|
||||
? String(avatarInfo?.data?.lang).toLowerCase()
|
||||
: undefined,
|
||||
avatar: avatarInfo?.data?.avatar,
|
||||
fullName: avatarInfo?.data?.full_name,
|
||||
};
|
||||
|
||||
@@ -11,6 +11,7 @@ interface LoginOutUser {
|
||||
}
|
||||
|
||||
async function logoutActiveSession(payload: LoginOutUser) {
|
||||
"use server";
|
||||
const cookieStore = await cookies();
|
||||
cookieStore.delete("accessToken");
|
||||
cookieStore.delete("accessObject");
|
||||
|
||||
@@ -52,10 +52,12 @@ export async function handleFormSubmission(formData: FormData): Promise<void> {
|
||||
} else if (key.includes("section")) {
|
||||
} else if (key.includes("ACTION_ID")) {
|
||||
} else {
|
||||
inputs.query = {
|
||||
...inputs.query,
|
||||
[key]: value,
|
||||
};
|
||||
if (value) {
|
||||
inputs.query = {
|
||||
...inputs.query,
|
||||
[key]: value,
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
const queryEncrypt = await encryptQuery(inputs);
|
||||
@@ -63,3 +65,25 @@ export async function handleFormSubmission(formData: FormData): Promise<void> {
|
||||
`/${formData.get("section")}?q=${queryEncrypt.replaceAll(" ", "+")}`
|
||||
);
|
||||
}
|
||||
|
||||
export async function handleCreateSubmission({
|
||||
section,
|
||||
data,
|
||||
}: {
|
||||
section: string;
|
||||
data: any;
|
||||
}) {
|
||||
const queryEncrypt = await encryptQuery(data);
|
||||
redirect(`/${section}/create?q=${queryEncrypt.replaceAll(" ", "+")}`);
|
||||
}
|
||||
|
||||
export async function handleUpdateSubmission({
|
||||
section,
|
||||
data,
|
||||
}: {
|
||||
section: string;
|
||||
data: any;
|
||||
}) {
|
||||
const queryEncrypt = await encryptQuery(data);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
"use server";
|
||||
import { fetchData, fetchDataWithToken } from "@/apicalls/api-fetcher";
|
||||
import { baseUrl, cookieObject, tokenSecret } from "@/apicalls/basics";
|
||||
|
||||
import { HeadersAndValidations } from "@/apicalls/validations/validationProcesser";
|
||||
|
||||
const headersAndValidationEndpoint = `${baseUrl}/validations/endpoint`;
|
||||
@@ -28,15 +27,14 @@ async function retrieveHeadersEndpoint({ endpoint }: EndpointInterface) {
|
||||
}
|
||||
return {
|
||||
status: selectResponse.status,
|
||||
headers: {},
|
||||
message: selectResponse.message,
|
||||
headers: {},
|
||||
};
|
||||
}
|
||||
|
||||
async function retrieveHeadersAndValidationByEndpoint({
|
||||
endpoint,
|
||||
}: EndpointInterface) {
|
||||
console.log("endpoint", endpoint);
|
||||
const selectResponse: any = await fetchDataWithToken(
|
||||
headersAndValidationEndpoint,
|
||||
{
|
||||
@@ -58,7 +56,6 @@ async function retrieveHeadersAndValidationByEndpoint({
|
||||
return {
|
||||
status: selectResponse.status,
|
||||
message: selectResponse.message,
|
||||
|
||||
headers: null,
|
||||
validated: null,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user