manifest + fav icon + title page

This commit is contained in:
hamid zarghami
2025-12-23 09:45:01 +03:30
parent bee8127450
commit 8135de464d
5 changed files with 195 additions and 16 deletions
+37
View File
@@ -0,0 +1,37 @@
import { API_BASE_URL } from "@/config/const";
import { AboutResponse, Restaurant } from "./(Main)/about/types/Types";
export async function getRestaurant(slug: string): Promise<Restaurant> {
try {
const response = await fetch(
`${API_BASE_URL}/public/restaurants/${slug}`,
{
cache: "no-store",
headers: {
"Content-Type": "application/json",
},
}
);
if (!response.ok) {
if (response.status === 404) {
throw new Error("RESTAURANT_NOT_FOUND");
}
throw new Error(`Failed to fetch restaurant: ${response.status}`);
}
const data: AboutResponse = await response.json();
if (!data.success || !data.data) {
throw new Error("RESTAURANT_NOT_FOUND");
}
return data.data;
} catch (error) {
if (error instanceof Error && error.message === "RESTAURANT_NOT_FOUND") {
throw error;
}
throw new Error(`Failed to fetch restaurant data: ${error}`);
}
}