Switch to tsconfig

Fix changes due to change in target module
This commit is contained in:
Michał Gdula 2024-05-15 16:36:29 +01:00
parent 2ef63ac6f6
commit 46b624954c
4 changed files with 16 additions and 17 deletions

View file

@ -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;
}

View file

@ -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
View 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`;
};
}