mirror of
https://github.com/Fluffy-Bean/TastyBites.git
synced 2025-05-29 14:53:13 +00:00
Merge pull request #13 from Fluffy-Bean/deepsource-transform-72e4c76c
style: format code with Prettier
This commit is contained in:
commit
a1678ff751
1 changed files with 5 additions and 4 deletions
|
@ -17,7 +17,8 @@ function createCartStore() {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const newData: Record<string, CartItem> = await postVerifyCart(localData);
|
const newData: Record<string, CartItem> =
|
||||||
|
await postVerifyCart(localData);
|
||||||
cart.set(newData);
|
cart.set(newData);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Could not load basket:", error);
|
console.error("Could not load basket:", error);
|
||||||
|
@ -28,7 +29,7 @@ function createCartStore() {
|
||||||
|
|
||||||
async function addToCart(uuid: string, amount: number) {
|
async function addToCart(uuid: string, amount: number) {
|
||||||
if (!loaded) {
|
if (!loaded) {
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (get(cart)[uuid] !== undefined) {
|
if (get(cart)[uuid] !== undefined) {
|
||||||
|
@ -83,7 +84,7 @@ function createCartStore() {
|
||||||
|
|
||||||
function removeByUUID(uuid: string) {
|
function removeByUUID(uuid: string) {
|
||||||
if (!loaded) {
|
if (!loaded) {
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cart.update((cart) => {
|
cart.update((cart) => {
|
||||||
|
@ -106,7 +107,7 @@ function createCartStore() {
|
||||||
|
|
||||||
// Create store
|
// Create store
|
||||||
const Cart = createCartStore();
|
const Cart = createCartStore();
|
||||||
export const cartLoaded = Cart.init()
|
export const cartLoaded = Cart.init();
|
||||||
|
|
||||||
// Make sure to update localstorage on any changes
|
// Make sure to update localstorage on any changes
|
||||||
Cart.subscribe((value) => {
|
Cart.subscribe((value) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue