From 318bbbdf7dab421ace9c7fe4edb016d89f203e49 Mon Sep 17 00:00:00 2001 From: silverpill Date: Sun, 12 Feb 2023 23:40:16 +0000 Subject: [PATCH] Use /api/v1/{status_id}/thread API endpoint to load threads --- CHANGELOG.md | 1 + src/api/posts.ts | 4 ++-- src/views/PostDetail.vue | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b469716..9c81b01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Changed - Remove invisible characters from display names. +- Use `/api/v1/{status_id}/thread` API endpoint to load threads. ## [1.13.0] - 2023-02-06 diff --git a/src/api/posts.ts b/src/api/posts.ts index 189137e..84cecad 100644 --- a/src/api/posts.ts +++ b/src/api/posts.ts @@ -149,11 +149,11 @@ export async function getProfileTimeline( return data } -export async function getPostContext( +export async function getPostThread( authToken: string | null, postId: string, ): Promise { - const url = `${BACKEND_URL}/api/v1/statuses/${postId}/context` + const url = `${BACKEND_URL}/api/v1/statuses/${postId}/thread` const response = await http(url, { authToken }) const data = await response.json() if (response.status !== 200) { diff --git a/src/views/PostDetail.vue b/src/views/PostDetail.vue index 2e71cc7..8134281 100644 --- a/src/views/PostDetail.vue +++ b/src/views/PostDetail.vue @@ -25,7 +25,7 @@ import { nextTick, onMounted } from "vue" import { $, $ref } from "vue/macros" import { useRoute } from "vue-router" -import { Post as PostObject, getPostContext } from "@/api/posts" +import { Post as PostObject, getPostThread } from "@/api/posts" import Loader from "@/components/Loader.vue" import Post from "@/components/Post.vue" import SidebarLayout from "@/components/SidebarLayout.vue" @@ -38,7 +38,7 @@ let selectedId = $ref(route.params.postId as string) let highlightedId = $ref(null) let thread = $ref([]) let isLoading = $ref(true) -const loaded = $ref(getPostContext(authToken, selectedId)) +const loaded = $ref(getPostThread(authToken, selectedId)) onMounted(async () => { try {