Use /api/v1/{status_id}/thread API endpoint to load threads

This commit is contained in:
silverpill 2023-02-12 23:40:16 +00:00
parent f95fac41f6
commit 318bbbdf7d
3 changed files with 5 additions and 4 deletions

View file

@ -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

View file

@ -149,11 +149,11 @@ export async function getProfileTimeline(
return data
}
export async function getPostContext(
export async function getPostThread(
authToken: string | null,
postId: string,
): Promise<Post[]> {
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) {

View file

@ -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<string | null>(null)
let thread = $ref<PostObject[]>([])
let isLoading = $ref(true)
const loaded = $ref(getPostContext(authToken, selectedId))
const loaded = $ref(getPostThread(authToken, selectedId))
onMounted(async () => {
try {