mirror of
https://github.com/ichsankurnia/hats-app.git
synced 2026-12-05 11:06:29 +00:00
update opengraph
This commit is contained in:
@@ -20,6 +20,7 @@ export default async function fetchData(url: string = '/', cache: "default" | "f
|
||||
|
||||
// Recommendation: handle errors
|
||||
if (!res.ok) {
|
||||
console.log("FETCH ERROR DATA :", res.status, data)
|
||||
if (res.status === 401 || res.status === 403) return redirect(`/auth?error=Session error or has expired !`)
|
||||
// This will activate the closest `error.js` Error Boundary
|
||||
throw new Error(`(${data.code || res.status}) ${data.message || res.statusText}`)
|
||||
@@ -55,6 +56,7 @@ export async function fetchDataWithPost(url: string = '/', payload: any = {}, ca
|
||||
}
|
||||
|
||||
if (!res.ok) {
|
||||
console.log("FETCH ERROR DATA :", res.status, data)
|
||||
if (res.status === 401 || res.status === 403) redirect(`/auth?error=Session error or has expired !`);
|
||||
|
||||
throw new Error(`(${data?.code || res.status} ${res.statusText}) ${data?.message}`);
|
||||
|
||||
Reference in New Issue
Block a user