Skip to content

Commit

Permalink
Fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
allanlasser committed Mar 6, 2024
1 parent 69687be commit eae75ff
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/routes/app/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<title>DocumentCloud</title>
</svelte:head>

<MainLayout basement={data.basement}>
<MainLayout>
<svelte:fragment slot="navigation">
<Documents />
<Projects />
Expand Down
8 changes: 0 additions & 8 deletions src/routes/app/+layout.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
import { getPinnedAddons } from "@/lib/api/addons";

export async function load({ url, fetch }) {
const { pathname } = url;
console.log(pathname);
const pinnedAddons = getPinnedAddons(fetch);
const isAddOnRoute = pathname.match(/\/app\/add-ons\/?/);
const isProjectRoute = pathname.match(/\/app\/projects\/?/);
const basement = isAddOnRoute ? "right" : isProjectRoute ? "left" : null;
return {
pinnedAddons,
isAddOnRoute,
isProjectRoute,
basement,
};
}
17 changes: 7 additions & 10 deletions src/routes/app/add-ons/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import Pin from "@/common/icons/Pin.svelte";
import Star from "@/common/icons/Star.svelte";
import Credit from "@/common/icons/Credit.svelte";
import type { Page } from "@/api/types/common.js";
let per_page = 10;
Expand All @@ -21,20 +22,18 @@
filter: $filter,
});
$: url = buildUrl(urlParams);
$: next_url = data.addons.next ? new URL(data.addons.next).toString() : null;
$: previous_url = data.addons.previous
? new URL(data.addons.previous).toString()
: null;
$: items = data.addons.results;
$: next_url = res.next ? new URL(res.next).toString() : null;
$: previous_url = res.previous ? new URL(res.previous).toString() : null;
$: items = res.results;
/** Network logic */
let loading = false;
let error = null;
let res: Page<AddOnListItem>;
export async function load(url) {
loading = true;
data = await fetch(url, {
res = await fetch(url, {
credentials: "include",
})
.then(async (r) => {
Expand Down Expand Up @@ -86,9 +85,7 @@
<p class="message">{$_("addonBrowserDialog.premiumTip")}</p>
</aside>
{/if}
{#await data.addons then res}
<AddOnList {loading} {items} {error} {reload} />
{/await}
<AddOnList {loading} {items} {error} {reload} />
</div>
<div class="pagination">
<Paginator
Expand Down

0 comments on commit eae75ff

Please sign in to comment.