diff options
author | 2022-03-16 16:17:34 +0000 | |
---|---|---|
committer | 2022-03-16 16:17:34 +0000 | |
commit | 279774c48e1d05af5a01d94009296245f2e0abac (patch) | |
tree | 588af056472549a75ededb92fcc395731507ba76 /examples/ssr/src/api.ts | |
parent | 4c25a1c2eacf897427a7d6dac3bf476ef56799de (diff) | |
download | astro-279774c48e1d05af5a01d94009296245f2e0abac.tar.gz astro-279774c48e1d05af5a01d94009296245f2e0abac.tar.zst astro-279774c48e1d05af5a01d94009296245f2e0abac.zip |
[ci] format
Diffstat (limited to 'examples/ssr/src/api.ts')
-rw-r--r-- | examples/ssr/src/api.ts | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/examples/ssr/src/api.ts b/examples/ssr/src/api.ts index b71990f3f..40058360b 100644 --- a/examples/ssr/src/api.ts +++ b/examples/ssr/src/api.ts @@ -22,7 +22,7 @@ const origin = MODE === 'development' ? `http://127.0.0.1:3000` : `http://127.0. async function get<T>(endpoint: string, cb: (response: Response) => Promise<T>): Promise<T> { const response = await fetch(`${origin}${endpoint}`, { - credentials: 'same-origin' + credentials: 'same-origin', }); if (!response.ok) { // TODO make this better... @@ -46,14 +46,14 @@ export async function getProduct(id: number): Promise<Product> { } export async function getUser(): Promise<User> { - return get<User>(`/api/user`, async response => { + return get<User>(`/api/user`, async (response) => { const user: User = await response.json(); return user; }); } export async function getCart(): Promise<Cart> { - return get<Cart>(`/api/cart`, async response => { + return get<Cart>(`/api/cart`, async (response) => { const cart: Cart = await response.json(); return cart; }); @@ -66,11 +66,11 @@ export async function addToUserCart(id: number | string, name: string): Promise< mode: 'no-cors', headers: { 'Content-Type': 'application/json', - 'Cache': 'no-cache' + Cache: 'no-cache', }, body: JSON.stringify({ id, - name - }) + name, + }), }); } |