load logo in client
Build and Deploy Docker Images / build_and_deploy (push) Has been cancelled

This commit is contained in:
hamid zarghami
2026-06-03 22:25:26 +03:30
parent dc3646eef6
commit ace6a0b288
1870 changed files with 104 additions and 345 deletions
+15 -13
View File
@@ -3,23 +3,22 @@ import { API_BASE_URL } from "@/config/const";
import { AboutResponse, Restaurant } from "../(Main)/about/types/Types";
import axios from "axios";
export const RESTAURANT_FETCH_TIMEOUT_MS = 10_000;
async function fetchRestaurant(slug: string): Promise<Restaurant> {
try {
const response = await axios(`${API_BASE_URL}/public/restaurants/${slug}`, {
headers: {
"Content-Type": "application/json",
"X-SLUG": slug,
const response = await axios.get<AboutResponse>(
`${API_BASE_URL}/public/restaurants/${slug}`,
{
headers: {
"Content-Type": "application/json",
"X-SLUG": slug,
},
timeout: RESTAURANT_FETCH_TIMEOUT_MS,
},
});
);
if (!response.data) {
if (response.status === 404) {
throw new Error("RESTAURANT_NOT_FOUND");
}
throw new Error(`Failed to fetch restaurant: ${response.status}`);
}
const data: AboutResponse = await response.data;
const data = response.data;
if (!data.success || !data.data) {
throw new Error("RESTAURANT_NOT_FOUND");
@@ -30,6 +29,9 @@ async function fetchRestaurant(slug: string): Promise<Restaurant> {
if (error instanceof Error && error.message === "RESTAURANT_NOT_FOUND") {
throw error;
}
if (axios.isAxiosError(error) && error.response?.status === 404) {
throw new Error("RESTAURANT_NOT_FOUND");
}
throw new Error(`Failed to fetch restaurant data: ${error}`);
}
}