diff --git a/src/api/posts.ts b/src/api/posts.ts index eb39626..d95f40c 100644 --- a/src/api/posts.ts +++ b/src/api/posts.ts @@ -59,6 +59,22 @@ export async function getHomeTimeline( return data } +export async function getTagTimeline( + authToken: string | null, + tagName: string, + maxId?: string, +): Promise { + const url = `${BACKEND_URL}/api/v1/timelines/tag/${tagName}` + const queryParams = { max_id: maxId, limit: PAGE_SIZE } + const response = await http(url, { + method: "GET", + queryParams, + authToken, + }) + const data = await response.json() + return data +} + export async function getPostsByAuthor( authToken: string | null, authorId: string, diff --git a/src/router/index.ts b/src/router/index.ts index e51549c..68df330 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -10,6 +10,7 @@ import ProfileForm from "@/views/ProfileForm.vue" import PostList from "@/views/PostList.vue" import PostDetail from "@/views/PostDetail.vue" import PostOverlay from "@/views/PostOverlay.vue" +import TagTimeline from "@/views/TagTimeline.vue" import SearchResultList from "@/views/SearchResultList.vue" import { useCurrentUser } from "@/store/user" @@ -67,6 +68,12 @@ const routes: Array = [ component: PostOverlay, meta: { }, }, + { + path: "/tag/:tagName", + name: "tag", + component: TagTimeline, + meta: { }, + }, { path: "/notifications", name: "notifications", diff --git a/src/views/TagTimeline.vue b/src/views/TagTimeline.vue new file mode 100644 index 0000000..c5abb61 --- /dev/null +++ b/src/views/TagTimeline.vue @@ -0,0 +1,73 @@ + + + + +