Skip to content

Commit

Permalink
fix(functions): remove useless fetch param everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
fourstepper committed Dec 15, 2023
1 parent 25d5fb1 commit be84c2f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/routes/posts/+page.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const load = async ({ url, fetch }: { url: URL; fetch: any }) => {
export const load = async ({ url }: { url: URL }) => {
const postRes = await fetch(`${url.origin}/api/posts.json`);
const posts = await postRes.json();

Expand Down
2 changes: 1 addition & 1 deletion src/routes/posts/tags/+page.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const load = async ({ url, fetch }: { url: URL; fetch: any }) => {
export const load = async ({ url }: { url: URL }) => {
const postRes = await fetch(`${url.origin}/api/posts.json`);
const posts = await postRes.json();

Expand Down
13 changes: 6 additions & 7 deletions src/routes/posts/tags/[tag]/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<script lang="ts">
import PostsList from "$lib/components/PostsList.svelte";
import { siteTitle } from "$lib/config";
export let data;
</script>
Expand All @@ -18,10 +17,10 @@
<PostsList posts={data.filteredPosts} />

<style lang="scss">
span {
color: getColor(red);
}
h1 {
margin-bottom: 0;
}
span {
color: getColor(red);
}
h1 {
margin-bottom: 0;
}
</style>
10 changes: 5 additions & 5 deletions src/routes/posts/tags/[tag]/+page.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
export const load = async ({ url, fetch, params }: { url: URL; fetch: any, params: any }) => {
export const load = async ({ url, params }: { url: URL; params: any }) => {
const postRes = await fetch(`${url.origin}/api/posts.json`);
const posts = await postRes.json();

let filteredPosts : any = []
let filteredPosts: any = [];

for (let post of posts) {
if (post.tags && post.tags.includes(params.tag)) {
filteredPosts.push(post)
}
if (post.tags && post.tags.includes(params.tag)) {
filteredPosts.push(post);
}
}

return { filteredPosts, params };
Expand Down

0 comments on commit be84c2f

Please sign in to comment.