🔒 (security) security improvement
This commit is contained in:
@ -1,21 +1,21 @@
|
||||
export const API_BASE_URL =
|
||||
process.env.MAIN_BACKEND_API_URL ?? "http://localhost";
|
||||
|
||||
const apiFetch = async <T = unknown>(
|
||||
path: string,
|
||||
init?: RequestInit
|
||||
): Promise<T> => {
|
||||
const res = await fetch(`${API_BASE_URL}${path}`, {
|
||||
...init,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
...init?.headers,
|
||||
},
|
||||
cache: "no-store",
|
||||
});
|
||||
|
||||
if (!res.ok) throw new Error(await res.text());
|
||||
return res.json();
|
||||
};
|
||||
|
||||
export default apiFetch;
|
||||
export const API_BASE_URL =
|
||||
process.env.MAIN_BACKEND_API_URL ?? "http://localhost";
|
||||
|
||||
const apiFetch = async <T = unknown>(
|
||||
path: string,
|
||||
init?: RequestInit
|
||||
): Promise<T> => {
|
||||
const res = await fetch(`${API_BASE_URL}${path}`, {
|
||||
...init,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
...init?.headers,
|
||||
},
|
||||
cache: "no-store",
|
||||
});
|
||||
|
||||
if (!res.ok) throw new Error(await res.text());
|
||||
return res.json();
|
||||
};
|
||||
|
||||
export default apiFetch;
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
export const delayButtonClick = (
|
||||
router: ReturnType<typeof useRouter>,
|
||||
href: string,
|
||||
timeout: number = 300
|
||||
) => {
|
||||
setTimeout(() => {
|
||||
router.push(href);
|
||||
}, timeout);
|
||||
};
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
export const delayButtonClick = (
|
||||
router: ReturnType<typeof useRouter>,
|
||||
href: string,
|
||||
timeout: number = 300
|
||||
) => {
|
||||
setTimeout(() => {
|
||||
router.push(href);
|
||||
}, timeout);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user