import { getEnvs } from "@/libs/environment/env"; interface IPathVariables { baseUrl: string; path: string; token: string; languageCode: string; } export interface IPathResponse { result?: { visual?: { style: IPathResponseStyle; }; data?: IPathResponseData; children: any[]; }; success: boolean; } interface IPathResponseStyle { borderRadius: string | null; fontFamily: string | null; fontSize: string | null; backgroundColor: string | null; margin: string | null; componentMargin: number | string | null; color: string | null; position: string | null; fontWeight: string | null; lineHeight: string | null; zIndex: string | null; opacity: string | null; paddingRight: string | null; paddingTop: string | null; paddingBottom: string | null; paddingLeft: string | null; marginRight: string | null; marginTop: string | null; marginBottom: string | null; marginLeft: string | null; left: string | null; top: string | null; right: string | null; bottom: string | null; cursor: string | null; borderBottom: string | null; borderTop: string | null; borderRight: string | null; borderLeft: string | null; gap: string | null; display: string | null; alignItems: string | null; padding: string | null; border: string | null; justifyContent: string | null; flexDirection: string | null; width: string | null; textAlign: string | null; whiteSpace: string | null; } interface IPathResponseData { pageName: string | null; seoTitle: string | null; seoDescription: string | null; seoKeyword: string | null; index: boolean; canonicalUrl: string | null; code: string; outputData: string | null; type: number; name: string | null; status: number; } export const getPathService = async (variables: IPathVariables) => { const envs = getEnvs(variables.baseUrl); const url = `${envs.wlDisplayUrl}/api/v1/strategy/get?path=/${variables.path}&LanguageCode=${variables.languageCode}`; try { const response = await fetch(url, { method: "GET", headers: { Authorization: `Bearer ${variables.token}` }, }); const responseJson = await response.json(); return responseJson as IPathResponse; } catch (error) { return null; } };