Use /api/v1/{status_id}/thread API endpoint to load threads
This commit is contained in:
parent
f95fac41f6
commit
318bbbdf7d
3 changed files with 5 additions and 4 deletions
|
@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Remove invisible characters from display names.
|
- Remove invisible characters from display names.
|
||||||
|
- Use `/api/v1/{status_id}/thread` API endpoint to load threads.
|
||||||
|
|
||||||
## [1.13.0] - 2023-02-06
|
## [1.13.0] - 2023-02-06
|
||||||
|
|
||||||
|
|
|
@ -149,11 +149,11 @@ export async function getProfileTimeline(
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getPostContext(
|
export async function getPostThread(
|
||||||
authToken: string | null,
|
authToken: string | null,
|
||||||
postId: string,
|
postId: string,
|
||||||
): Promise<Post[]> {
|
): 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 response = await http(url, { authToken })
|
||||||
const data = await response.json()
|
const data = await response.json()
|
||||||
if (response.status !== 200) {
|
if (response.status !== 200) {
|
||||||
|
|
|
@ -25,7 +25,7 @@ import { nextTick, onMounted } from "vue"
|
||||||
import { $, $ref } from "vue/macros"
|
import { $, $ref } from "vue/macros"
|
||||||
import { useRoute } from "vue-router"
|
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 Loader from "@/components/Loader.vue"
|
||||||
import Post from "@/components/Post.vue"
|
import Post from "@/components/Post.vue"
|
||||||
import SidebarLayout from "@/components/SidebarLayout.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 highlightedId = $ref<string | null>(null)
|
||||||
let thread = $ref<PostObject[]>([])
|
let thread = $ref<PostObject[]>([])
|
||||||
let isLoading = $ref(true)
|
let isLoading = $ref(true)
|
||||||
const loaded = $ref(getPostContext(authToken, selectedId))
|
const loaded = $ref(getPostThread(authToken, selectedId))
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in a new issue