v0.1.47 - 관리자 계정 정리 기능 추가

This commit is contained in:
2026-04-24 11:43:22 +09:00
parent c442e0d8bb
commit 317a2ce8af
12 changed files with 350 additions and 14 deletions

View File

@@ -1,10 +1,14 @@
import { buildApiUrl, toUserFacingApiError } from './apiBase'
async function request(path, token) {
async function request(path, token, { method = 'GET', body } = {}) {
const hasBody = body !== undefined
const response = await fetch(buildApiUrl(path), {
method,
headers: {
Authorization: `Bearer ${token}`,
...(hasBody ? { 'Content-Type': 'application/json' } : {}),
},
body: hasBody ? JSON.stringify(body) : undefined,
})
const data = await response.json().catch(() => ({}))
@@ -19,3 +23,22 @@ async function request(path, token) {
export async function fetchAdminOverview(token) {
return request('/api/admin/overview', token)
}
export async function updateAdminUserStatus(token, userId, disabled) {
return request(`/api/admin/users/${userId}/status`, token, {
method: 'PUT',
body: { disabled },
})
}
export async function revokeAdminUserSessions(token, userId) {
return request(`/api/admin/users/${userId}/revoke-sessions`, token, {
method: 'POST',
})
}
export async function deleteAdminUser(token, userId) {
return request(`/api/admin/users/${userId}`, token, {
method: 'DELETE',
})
}