diff --git a/src/admin-core/hooks/useQueryEngine.ts b/src/admin-core/hooks/useQueryEngine.ts index 752b6c8..f47915f 100644 --- a/src/admin-core/hooks/useQueryEngine.ts +++ b/src/admin-core/hooks/useQueryEngine.ts @@ -2,6 +2,12 @@ export const useQueryEngine = () => { const defaultHeaders = { Accept: "application/json", "Content-Type": "application/json", + Origin: "http://localhost:3000", + Referer: "http://localhost:3000", + "Access-Control-Allow-Origin": "http://localhost:3000", + "Access-Control-Allow-Headers": + "Origin, X-Requested-With, Content-Type, Accept, X-XSRF-TOKEN, Authorization, Cookie", + "Access-Control-Allow-Credentials": true, }; const response = async (request: Request) => { @@ -37,6 +43,7 @@ export const useQueryEngine = () => { return await response( new Request(url, { + mode: "cors", credentials: "include", ...(options?.method ? { method: options.method } : { method: "GET" }), ...(options.replaceHeaders @@ -46,6 +53,7 @@ export const useQueryEngine = () => { ...defaultHeaders, Authorization: `Bearer ${localStorage.getItem("user")}`, "X-XSRF-TOKEN": localStorage.getItem("user"), + "Access-Control-Request-Method": options?.method ? options.method : "GET", ...(options?.headers ? { ...options.headers } : {}), }), }),