Skip to content

Commit

Permalink
add base path to api too
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniele Ciminieri committed Sep 18, 2024
1 parent 1b517f2 commit 4c24971
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/routes/+page.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { base } from '$app/paths';

export async function load({ url, fetch }) {
const corsi = await fetch(`/api/corsi`);
const corsi = await fetch(`${base}/api/corsi`);
return {
corsi: await corsi.json()
};
Expand Down
4 changes: 3 additions & 1 deletion src/routes/corsi/[slug]/+page.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { base } from '$app/paths';

export async function load({ params, fetch }) {
const { slug } = params;
const response = await fetch(`/api/corsi/${slug}`);
const response = await fetch(`${base}/api/corsi/${slug}`);
const corso = await response.json();

return { corso };
Expand Down
4 changes: 3 additions & 1 deletion src/routes/gruppi/[slug]/+page.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { base } from '$app/paths';

export async function load({ params, fetch }) {
const { slug } = params;
const response = await fetch(`/api/gruppi/${slug}`);
const response = await fetch(`${base}/api/gruppi/${slug}`);
const gruppo = await response.json();

return { gruppo };
Expand Down

0 comments on commit 4c24971

Please sign in to comment.