mirror of
https://github.com/Fluffy-Bean/TastyBites.git
synced 2024-12-28 02:16:07 +00:00
Switch to tsconfig
Fix changes due to change in target module
This commit is contained in:
parent
2ef63ac6f6
commit
46b624954c
|
@ -3,14 +3,11 @@ import { type Item, type JSONResponse } from "./types";
|
||||||
const API_URL = "http://127.0.0.1:8080";
|
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: 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) throw new Error(error);
|
||||||
if (data?.item) {
|
if (!data?.item) throw new Error("Failed to fetch popular today");
|
||||||
return data?.item;
|
|
||||||
}
|
return data?.item;
|
||||||
throw new Error("Failed to fetch popular today");
|
|
||||||
}
|
|
||||||
throw new Error(error);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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`;
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,14 +1,15 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"moduleResolution": "bundler",
|
"moduleResolution": "bundler",
|
||||||
"target": "ESNext",
|
"module": "ES2015",
|
||||||
"module": "ESNext",
|
"target": "ES2017",
|
||||||
|
"lib": ["ES2017", "DOM"],
|
||||||
/**
|
/**
|
||||||
* svelte-preprocess cannot figure out whether you have
|
* svelte-preprocess cannot figure out whether you have
|
||||||
* a value or a type, so tell TypeScript to enforce using
|
* a value or a type, so tell TypeScript to enforce using
|
||||||
* `import type` instead of `import` for Types.
|
* `import type` instead of `import` for Types.
|
||||||
*/
|
*/
|
||||||
"verbatimModuleSyntax": true,
|
"verbatimModuleSyntax": false,
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
/**
|
/**
|
||||||
|
@ -22,6 +23,7 @@
|
||||||
* Typecheck JS in `.svelte` and `.js` files by default.
|
* Typecheck JS in `.svelte` and `.js` files by default.
|
||||||
* Disable this if you'd like to use dynamic types.
|
* Disable this if you'd like to use dynamic types.
|
||||||
*/
|
*/
|
||||||
|
"allowJs": true,
|
||||||
"checkJs": true
|
"checkJs": true
|
||||||
},
|
},
|
||||||
/**
|
/**
|
Loading…
Reference in a new issue