Skip to content

Commit

Permalink
Fixing addon page data loading
Browse files Browse the repository at this point in the history
  • Loading branch information
allanlasser committed Mar 6, 2024
1 parent eae75ff commit 3452e4e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/addons/browser/browser.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { writable } from "svelte/store";
import { baseApiUrl } from "../../api/base.js";
import { BASE_API_URL } from "@/config/config.js";

export const filter = writable("featured");

Expand Down Expand Up @@ -52,7 +52,7 @@ export function buildParams({
}

export function buildUrl({ query = "", filters = {}, per_page = 5 }) {
const u = new URL("addons/", baseApiUrl);
const u = new URL("addons/", BASE_API_URL);

u.search = new URLSearchParams({
query,
Expand Down
6 changes: 3 additions & 3 deletions src/routes/app/add-ons/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@
import Star from "@/common/icons/Star.svelte";
import Credit from "@/common/icons/Credit.svelte";
import type { Page } from "@/api/types/common.js";
import { onMount } from "svelte";
let per_page = 10;
export let data;
$: urlParams = buildParams({
per_page,
query: $query,
Expand All @@ -32,7 +31,7 @@
export async function load(url) {
loading = true;
console.log(url);
res = await fetch(url, {
credentials: "include",
})
Expand All @@ -50,6 +49,7 @@
loading = false;
}
onMount(() => load(url));
$: loadNext = () => load(next_url);
$: loadPrev = () => load(previous_url);
$: reload = () => load(url);
Expand Down
8 changes: 0 additions & 8 deletions src/routes/app/add-ons/+page.ts
Original file line number Diff line number Diff line change
@@ -1,8 +0,0 @@
import { getAddons } from "@/lib/api/addons";

export async function load({ fetch }) {
const addons = getAddons(fetch);
return {
addons,
};
}

0 comments on commit 3452e4e

Please sign in to comment.