style: format code with Prettier

This commit fixes the style issues introduced in 6e31b44 according to the output
from Prettier.

Details: None
This commit is contained in:
deepsource-autofix[bot] 2024-05-04 15:26:36 +00:00 committed by GitHub
parent 6e31b44137
commit cd6fdf3b29
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 131 additions and 105 deletions

View file

@ -1,9 +1,8 @@
import { type Writable, get, writable } from "svelte/store";
import {type CartItem, type Item } from './types';
import { type CartItem, type Item } from "./types";
import { getItemByUUID, postVerifyCart } from "./test-api";
// Load content from localstorage
let local: Record<string, CartItem> = {};
try {
@ -16,7 +15,7 @@ try {
throw error; // Hot potato style
});
} catch {
console.error("Failed to load cart")
console.error("Failed to load cart");
}
// Store function
@ -30,16 +29,17 @@ function createCartStore() {
return cart;
});
} else {
await getItemByUUID(uuid)
.then((data: Item) => {
cart.update((cart: Record<string, CartItem>) =>
Object.assign({}, cart, {[uuid]: {
await getItemByUUID(uuid).then((data: Item) => {
cart.update((cart: Record<string, CartItem>) =>
Object.assign({}, cart, {
[uuid]: {
uuid: uuid,
amount: amount,
data: data,
}})
);
});
},
})
);
});
}
cart.update((cart: Record<string, CartItem>) => {
@ -47,7 +47,7 @@ function createCartStore() {
delete cart[uuid];
}
return cart;
})
});
}
function getEntries(): [string, CartItem][] {
@ -69,7 +69,7 @@ function createCartStore() {
function getTotalPrice(): number {
let totalCartPrice: number = 0;
Object.values(get(cart)).forEach((item: CartItem) => {
totalCartPrice += (item.amount * item.data.price);
totalCartPrice += item.amount * item.data.price;
});
return totalCartPrice;
}
@ -78,7 +78,7 @@ function createCartStore() {
cart.update((cart) => {
delete cart[uuid];
return cart;
})
});
}
return {
@ -89,7 +89,7 @@ function createCartStore() {
getTotalLength,
getTotalPrice,
removeByUUID,
}
};
}
// Create store