diff --git a/.air.toml b/.air.toml index ba34b87..2981286 100644 --- a/.air.toml +++ b/.air.toml @@ -14,7 +14,7 @@ tmp_dir = "tmp" follow_symlink = false full_bin = "" include_dir = ["front", "api", "cmd"] - include_ext = ["go", "tpl", "tmpl", "html", "js", "svelte", "scss"] + include_ext = ["go", "tpl", "tmpl", "html", "js", "ts", "svelte", "scss"] include_file = [] kill_delay = "0s" log = "build-errors.log" diff --git a/front/src/lib/cart.ts b/front/src/lib/cart.ts index 4186221..b56182b 100644 --- a/front/src/lib/cart.ts +++ b/front/src/lib/cart.ts @@ -4,14 +4,7 @@ import { type CartItem, type Item } from "./types"; import { getItemByUUID, postVerifyCart } from "./test-api"; function getLocal(): Record { - let localData: Record = {}; - - try { - localData = JSON.parse(localStorage.getItem("basket")); - } catch (error) { - console.error("Could parse basket JSON:", error); - return localData; - } + let localData: Record = JSON.parse(localStorage.getItem("basket")) || {}; postVerifyCart(localData) .then((data: Record) => { @@ -19,6 +12,7 @@ function getLocal(): Record { }) .catch((error) => { console.error("Could not load basket:", error); + return >{}; }); return localData;