chore: move api to remanso.space
This commit is contained in:
@@ -3,11 +3,16 @@ import { PublicNoteListItem } from "@/modules/note/models/Note"
|
|||||||
import { computedAsync } from "@vueuse/core"
|
import { computedAsync } from "@vueuse/core"
|
||||||
import { computed, ref, Ref, watch } from "vue"
|
import { computed, ref, Ref, watch } from "vue"
|
||||||
|
|
||||||
export function useFollowingNoteList(dids: Ref<Set<string>>, enabled: Ref<boolean>) {
|
export function useFollowingNoteList(
|
||||||
|
dids: Ref<Set<string>>,
|
||||||
|
enabled: Ref<boolean>,
|
||||||
|
) {
|
||||||
const isLoading = ref(false)
|
const isLoading = ref(false)
|
||||||
const notes = ref<PublicNoteListItem[]>([])
|
const notes = ref<PublicNoteListItem[]>([])
|
||||||
const cursor = ref<string | null | undefined>(null)
|
const cursor = ref<string | null | undefined>(null)
|
||||||
const canLoadMore = computed(() => dids.value.size > 0 && cursor.value !== undefined)
|
const canLoadMore = computed(
|
||||||
|
() => dids.value.size > 0 && cursor.value !== undefined,
|
||||||
|
)
|
||||||
|
|
||||||
const onLoadMore = async () => {
|
const onLoadMore = async () => {
|
||||||
if (isLoading.value) return
|
if (isLoading.value) return
|
||||||
@@ -24,13 +29,14 @@ export function useFollowingNoteList(dids: Ref<Set<string>>, enabled: Ref<boolea
|
|||||||
body.cursor = cursor.value
|
body.cursor = cursor.value
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = await fetch("https://api.litenote.li212.fr/notes/feed", {
|
const response = await fetch("https://api.remanso.space/notes/feed", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
body: JSON.stringify(body),
|
body: JSON.stringify(body),
|
||||||
})
|
})
|
||||||
|
|
||||||
const data: { notes: PublicNoteListItem[]; cursor?: string } = await response.json()
|
const data: { notes: PublicNoteListItem[]; cursor?: string } =
|
||||||
|
await response.json()
|
||||||
|
|
||||||
notes.value.push(...data.notes)
|
notes.value.push(...data.notes)
|
||||||
cursor.value = data.cursor
|
cursor.value = data.cursor
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export function usePublicNoteList(options?: UsePublicNoteListOptions) {
|
|||||||
isLoading.value = true
|
isLoading.value = true
|
||||||
|
|
||||||
const path = options?.did?.value ? `/${options.did.value}/notes` : "/notes"
|
const path = options?.did?.value ? `/${options.did.value}/notes` : "/notes"
|
||||||
const noteAPI = new URL(path, "https://api.litenote.li212.fr")
|
const noteAPI = new URL(path, "https://api.remanso.space")
|
||||||
|
|
||||||
if (cursor.value) {
|
if (cursor.value) {
|
||||||
noteAPI.searchParams.set("cursor", cursor.value)
|
noteAPI.searchParams.set("cursor", cursor.value)
|
||||||
|
|||||||
@@ -60,5 +60,5 @@ export const noteRouter = contract.router({
|
|||||||
})
|
})
|
||||||
|
|
||||||
export const client = initQueryClient(noteRouter, {
|
export const client = initQueryClient(noteRouter, {
|
||||||
baseUrl: "https://api.litenote.li212.fr",
|
baseUrl: "https://api.remanso.space",
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user