mirror of
https://github.com/Fluffy-Bean/TastyBites.git
synced 2025-06-04 17:33:13 +00:00
Switch to tsconfig
Fix changes due to change in target module
This commit is contained in:
parent
2ef63ac6f6
commit
46b624954c
4 changed files with 16 additions and 17 deletions
|
@ -3,14 +3,11 @@ import { type Item, type JSONResponse } from "./types";
|
|||
const API_URL = "http://127.0.0.1:8080";
|
||||
|
||||
export async function getPopularToday(): Promise<Item[]> {
|
||||
const response = await fetch(`${API_URL}/api/items`);
|
||||
const response: Response = await fetch(`${API_URL}/api/items`);
|
||||
const { data, error }: JSONResponse = await response.json();
|
||||
|
||||
if (response.ok) {
|
||||
if (data?.item) {
|
||||
return data?.item;
|
||||
}
|
||||
throw new Error("Failed to fetch popular today");
|
||||
}
|
||||
throw new Error(error);
|
||||
if (!response.ok) throw new Error(error);
|
||||
if (!data?.item) throw new Error("Failed to fetch popular today");
|
||||
|
||||
return data?.item;
|
||||
}
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
export function expandOnTyping(element) {
|
||||
element.oninput = (event) => {
|
||||
event.target.style.height = ""; // skipcq: JS-W1032
|
||||
event.target.style.height = `${event.target.scrollHeight + 2}px`;
|
||||
};
|
||||
}
|
6
front/src/lib/utils.ts
Normal file
6
front/src/lib/utils.ts
Normal file
|
@ -0,0 +1,6 @@
|
|||
export function expandOnTyping(element: HTMLTextAreaElement) {
|
||||
element.oninput = () => {
|
||||
element.style.height = ""; // skipcq: JS-W1032
|
||||
element.style.height = `${element.scrollHeight + 2}px`;
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue