-
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.
- Loading branch information
1 parent
432c0de
commit f90f600
Showing
4 changed files
with
46 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export const useFetchFriendsFeed = async () => | ||
await $fetch("/api/feeds/friends"); |
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,17 +1,34 @@ | ||
<script setup lang="ts"> | ||
import { useQuery } from "@tanstack/vue-query"; | ||
const { isPending, isError, data, error } = useQuery({ | ||
queryKey: ["feeds", "friends"], | ||
queryFn: () => useFetchFriendsFeed(), | ||
}); | ||
</script> | ||
|
||
<template> | ||
<div class="flex text-zinc-900 dark:text-zinc-100 flex-col md:flex-row"> | ||
<div class="flex text-zinc-100 flex-col md:flex-row"> | ||
<aside | ||
class="flex h-screen bg-neutral-100 dark:bg-neutral-900 md:w-1/3 md:min-w-[24rem] sticky top-0 flex h-screen" | ||
class="flex h-screen bg-neutral-900 md:w-1/3 md:min-w-[24rem] sticky top-0" | ||
> | ||
<div | ||
class="py-2 px-2 md:pl-0 xl:max-w-2xl mx-auto lg:mx-0 lg:ml-auto flex flex-col w-full" | ||
> | ||
<NavBar /> | ||
|
||
<p v-if="isPending">Pending</p> | ||
<p v-if="isError">Error: {{ error }}</p> | ||
<p v-if="data"> | ||
{{ data.userPosts.posts[0].takenAt }} | ||
</p> | ||
</div> | ||
</aside> | ||
|
||
<main class="max-w-xl px-3 pt-5 grow"> | ||
<slot /> | ||
<main class="px-3 pt-5 grow flex justify-center"> | ||
<div class="max-w-md xl:max-w-lg"> | ||
<slot /> | ||
</div> | ||
</main> | ||
</div> | ||
</template> |
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,5 +1,24 @@ | ||
<script setup lang="ts"> | ||
import { useQuery } from "@tanstack/vue-query"; | ||
const { isPending, isError, data, error } = useQuery({ | ||
queryKey: ["feeds", "friends"], | ||
queryFn: () => useFetchFriendsFeed(), | ||
}); | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<NuxtLayout name="feed"><h1>content</h1></NuxtLayout> | ||
<NuxtLayout name="feed"> | ||
<p v-if="isPending">Pending</p> | ||
<p v-if="isError">Error: {{ error }}</p> | ||
|
||
<Post | ||
v-for="friendPost in data?.friendsPosts" | ||
:key="friendPost.user.id" | ||
v-bind="friendPost" | ||
class="pb-3" | ||
/> | ||
</NuxtLayout> | ||
</div> | ||
</template> |
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