mirror of
https://github.com/Fluffy-Bean/TastyBites.git
synced 2024-12-29 10:56:15 +00:00
Merge pull request #19 from Fluffy-Bean/deepsource-transform-c7cab386
style: format code with Prettier
This commit is contained in:
commit
df0563cdf2
|
@ -5,16 +5,16 @@ const API_URL = "http://127.0.0.1:8080";
|
||||||
|
|
||||||
export async function getPopularToday(): Promise<Item[]> {
|
export async function getPopularToday(): Promise<Item[]> {
|
||||||
const response = await fetch(API_URL + "/api/items");
|
const response = await fetch(API_URL + "/api/items");
|
||||||
const {data, error}: JSONResponse = await response.json();
|
const { data, error }: JSONResponse = await response.json();
|
||||||
|
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
if (data?.item) {
|
if (data?.item) {
|
||||||
return data?.item;
|
return data?.item;
|
||||||
} else {
|
} else {
|
||||||
return Promise.reject(new Error("Failed to fetch popular today"))
|
return Promise.reject(new Error("Failed to fetch popular today"));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return Promise.reject(error)
|
return Promise.reject(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,14 +14,14 @@ export type Item = {
|
||||||
description: string;
|
description: string;
|
||||||
labels?: Labels[];
|
labels?: Labels[];
|
||||||
images?: string[];
|
images?: string[];
|
||||||
}
|
};
|
||||||
|
|
||||||
export type CartItem = {
|
export type CartItem = {
|
||||||
amount: number;
|
amount: number;
|
||||||
data: Item;
|
data: Item;
|
||||||
}
|
};
|
||||||
|
|
||||||
export type JSONResponse = {
|
export type JSONResponse = {
|
||||||
data?: { item: Item[] }
|
data?: { item: Item[] };
|
||||||
error?: string,
|
error?: string;
|
||||||
}
|
};
|
||||||
|
|
Loading…
Reference in a new issue