-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Omit needless code (headers are set in hook)
- Loading branch information
Showing
11 changed files
with
28 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
import type { PageServerLoad } from './$types'; | ||
import { PUBLIC_REST_API_URL } from '$env/static/public'; | ||
|
||
export const load: PageServerLoad = async ({ params }) => { | ||
export const load: PageServerLoad = async ({ params, fetch }) => { | ||
return { | ||
bike: await fetch(`${PUBLIC_REST_API_URL}/bikes/${params.id}`, { | ||
method: 'GET' | ||
}).then((r) => r.json()) | ||
bike: await fetch(`${PUBLIC_REST_API_URL}/bikes/${params.id}`).then((r) => r.json()) | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
import type { PageServerLoad } from './$types'; | ||
import { PUBLIC_REST_API_URL } from '$env/static/public'; | ||
|
||
export const load: PageServerLoad = async () => { | ||
export const load: PageServerLoad = async ({ fetch }) => { | ||
return { | ||
bikes: await fetch(`${PUBLIC_REST_API_URL}/bikes`, { | ||
method: 'GET' | ||
}).then((r) => r.json()) | ||
bikes: await fetch(`${PUBLIC_REST_API_URL}/bikes`).then((r) => r.json()) | ||
}; | ||
}; |
6 changes: 2 additions & 4 deletions
6
src/routes/(protected)/admin/map/test/animate/+page.server.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
import type { PageServerLoad } from './$types'; | ||
import { PUBLIC_REST_API_URL } from '$env/static/public'; | ||
|
||
export const load: PageServerLoad = async () => { | ||
export const load: PageServerLoad = async ({ fetch }) => { | ||
return { | ||
bikes: await fetch(`${PUBLIC_REST_API_URL}/bikes`, { | ||
method: 'GET' | ||
}).then((r) => r.json()) | ||
bikes: await fetch(`${PUBLIC_REST_API_URL}/bikes`).then((r) => r.json()) | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,9 @@ | ||
import type { PageServerLoad } from './$types'; | ||
import { PUBLIC_REST_API_URL } from '$env/static/public'; | ||
|
||
export const load: PageServerLoad = async () => { | ||
export const load: PageServerLoad = async ({ fetch }) => { | ||
return { | ||
zones: await fetch(`${PUBLIC_REST_API_URL}/zones`, { | ||
method: 'GET' | ||
}).then((r) => r.json()), | ||
cities: await fetch(`${PUBLIC_REST_API_URL}/cities`, { | ||
method: 'GET' | ||
}).then((r) => r.json()) | ||
zones: await fetch(`${PUBLIC_REST_API_URL}/zones`).then((r) => r.json()), | ||
cities: await fetch(`${PUBLIC_REST_API_URL}/cities`).then((r) => r.json()) | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,8 @@ | ||
import type { PageServerLoad } from './$types'; | ||
import { PUBLIC_REST_API_URL } from '$env/static/public'; | ||
|
||
export const load: PageServerLoad = async ({ cookies, fetch }) => { | ||
export const load: PageServerLoad = async ({ fetch }) => { | ||
return { | ||
users: await fetch(`${PUBLIC_REST_API_URL}/admin/users`, { | ||
method: 'GET', | ||
// @ts-expect-error - We are aware that 'x-access-token' is not typed | ||
headers: { | ||
'x-access-token': cookies.get('access_token') | ||
} | ||
}).then((r) => r.json()) | ||
users: await fetch(`${PUBLIC_REST_API_URL}/admin/users`).then((r) => r.json()) | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 1 addition & 5 deletions
6
src/routes/(protected)/admin/users/[id]/transactions/+page.server.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 2 additions & 5 deletions
7
src/routes/(protected)/admin/users/[id]/trips/+page.server.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 2 additions & 8 deletions
10
src/routes/(protected)/admin/users/transactions/+page.server.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,8 @@ | ||
import type { PageServerLoad } from './$types'; | ||
import { PUBLIC_REST_API_URL } from '$env/static/public'; | ||
|
||
export const load: PageServerLoad = async ({ cookies, fetch }) => { | ||
export const load: PageServerLoad = async ({ fetch }) => { | ||
return { | ||
transactions: await fetch(`${PUBLIC_REST_API_URL}/admin/transactions/all`, { | ||
method: 'GET', | ||
// @ts-expect-error - We are aware that 'x-access-token' is not typed | ||
headers: { | ||
'x-access-token': cookies.get('access_token') | ||
} | ||
}).then((r) => r.json()) | ||
transactions: await fetch(`${PUBLIC_REST_API_URL}/admin/transactions/all`).then((r) => r.json()) | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,8 @@ | ||
import type { PageServerLoad } from './$types'; | ||
import { PUBLIC_REST_API_URL } from '$env/static/public'; | ||
|
||
export const load: PageServerLoad = async ({ cookies, fetch }) => { | ||
export const load: PageServerLoad = async ({ fetch }) => { | ||
return { | ||
trips: await fetch(`${PUBLIC_REST_API_URL}/admin/trips/all`, { | ||
method: 'GET', | ||
// @ts-expect-error - We are aware that 'x-access-token' is not typed | ||
headers: { | ||
'x-access-token': cookies.get('access_token') | ||
} | ||
}).then((r) => r.json()) | ||
trips: await fetch(`${PUBLIC_REST_API_URL}/admin/trips/all`).then((r) => r.json()) | ||
}; | ||
}; |