43 lines
1.0 KiB
JavaScript
43 lines
1.0 KiB
JavaScript
import { api } from './client'
|
|
|
|
export async function fetchAllUsers() {
|
|
const { data } = await api.get('/users')
|
|
return data
|
|
}
|
|
|
|
export async function fetchPendingUsers() {
|
|
const { data } = await api.get('/users/pending')
|
|
return data
|
|
}
|
|
|
|
export async function approveUser(userId) {
|
|
const { data } = await api.post(`/users/${userId}/approve`)
|
|
return data
|
|
}
|
|
|
|
export async function rejectUser(userId) {
|
|
const { data } = await api.post(`/users/${userId}/reject`)
|
|
return data
|
|
}
|
|
|
|
export async function deleteUser(userId) {
|
|
const { data } = await api.delete(`/users/${userId}`)
|
|
return data
|
|
}
|
|
|
|
export async function setUserVip(userId, days) {
|
|
const { data } = await api.post(`/users/${userId}/vip`, { days })
|
|
return data
|
|
}
|
|
|
|
export async function removeUserVip(userId) {
|
|
const { data } = await api.delete(`/users/${userId}/vip`)
|
|
return data
|
|
}
|
|
|
|
export async function adminResetUserPassword(userId, newPassword) {
|
|
const { data } = await api.post(`/users/${userId}/reset_password`, { new_password: newPassword })
|
|
return data
|
|
}
|
|
|