implements trail sharing

This commit is contained in:
Christian Beutel
2024-06-06 02:02:23 +02:00
parent 5d46ad96b4
commit ad5a4e668b
44 changed files with 1257 additions and 308 deletions

View File

@@ -24,8 +24,8 @@ export async function users_create(user: User) {
}
export async function users_search(q: string) {
let r = await fetch('/api/v1/user?' + new URLSearchParams({
"filter": `username~"${q}"`,
let r = await fetch('/api/v1/user/anonymous?' + new URLSearchParams({
"filter": `username~"${q}"&&id!="${pb.authStore.model?.id}"`,
}), {
method: 'GET',
})
@@ -38,6 +38,19 @@ export async function users_search(q: string) {
}
}
export async function users_show(id: string) {
let r = await fetch(`/api/v1/user/anonymous/${id}`, {
method: 'GET',
})
const response = await r.json()
if (r.ok) {
return response;
} else {
throw new ClientResponseError(response)
}
}
export async function users_auth_methods(f: (url: RequestInfo | URL, config?: RequestInit) => Promise<Response> = fetch): Promise<AuthMethodsList> {
const r = await f('/api/v1/auth/oauth', {
method: 'GET',