mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-07-17 18:16:10 +00:00
chore: migrate legacy pages and utilities to nuxt
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import { API_BASE_URL } from '../main'
|
||||
|
||||
export async function fetchFollowings(username) {
|
||||
if (!username) return []
|
||||
try {
|
||||
const res = await fetch(`${API_BASE_URL}/api/users/${username}/following`)
|
||||
return res.ok ? await res.json() : []
|
||||
} catch (e) {
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
||||
export async function fetchAdmins() {
|
||||
try {
|
||||
const res = await fetch(`${API_BASE_URL}/api/users/admins`)
|
||||
return res.ok ? await res.json() : []
|
||||
} catch (e) {
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
||||
export async function searchUsers(keyword) {
|
||||
if (!keyword) return []
|
||||
try {
|
||||
const res = await fetch(`${API_BASE_URL}/api/search/users?keyword=${encodeURIComponent(keyword)}`)
|
||||
return res.ok ? await res.json() : []
|
||||
} catch (e) {
|
||||
return []
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user