client: adjust API endpoints for user administration

This commit is contained in:
Johann150 2023-02-19 18:13:08 +01:00
parent bfd1adf761
commit 2fda599a86
Signed by: Johann150
GPG key ID: 9EE6577A2A06F8F1
8 changed files with 15 additions and 15 deletions

View file

@ -61,7 +61,7 @@ const emit = defineEmits<{
let forward = $ref(props.report.forwarded);
function resolve(): void {
os.apiWithDialog('admin/resolve-abuse-user-report', {
os.apiWithDialog('admin/reports/resolve', {
forward,
reportId: props.report.id,
}).then(() => {

View file

@ -52,7 +52,7 @@ let reporterOrigin = $ref('combined');
let targetUserOrigin = $ref('combined');
const pagination = {
endpoint: 'admin/abuse-user-reports' as const,
endpoint: 'admin/reports/list' as const,
limit: 10,
params: computed(() => ({
state,

View file

@ -61,7 +61,7 @@ let noBotProtection = !instance.disableRegistration && !instance.enableHcaptcha
let noEmailServer = !instance.enableEmail;
let thereIsUnresolvedAbuseReport = $ref(false);
os.api('admin/abuse-user-reports', {
os.api('admin/reports/list', {
state: 'unresolved',
limit: 1,
}).then(reports => {

View file

@ -71,7 +71,7 @@ let origin = $ref('local');
let searchUsername = $ref('');
let searchHost = $ref('');
const pagination = {
endpoint: 'admin/show-users' as const,
endpoint: 'admin/users' as const,
limit: 10,
params: computed(() => ({
sort,
@ -101,7 +101,7 @@ async function addUser(): Promise<void> {
});
if (canceled2) return;
os.apiWithDialog('admin/accounts/create', {
os.apiWithDialog('admin/users/create', {
username,
password,
}).then(() => {

View file

@ -166,7 +166,7 @@ let suspended = $ref(false);
let isBlocked = $ref(false);
const usersPagination = {
endpoint: iAmModerator ? 'admin/show-users' : 'users' as const,
endpoint: iAmModerator ? 'admin/users' : 'users' as const,
limit: 10,
params: {
sort: '+updatedAt',

View file

@ -149,7 +149,7 @@ function createFetcher() {
if (iAmModerator) {
return () => Promise.all([os.api('users/show', {
userId: props.userId,
}), os.api('admin/show-user', {
}), os.api('admin/users/show', {
userId: props.userId,
})]).then(([_user, _info]) => {
user = _user;
@ -177,7 +177,7 @@ async function updateRemoteUser() {
}
async function resetPassword() {
const { password } = await os.api('admin/reset-password', {
const { password } = await os.api('admin/users/reset-password', {
userId: user.id,
});
@ -195,7 +195,7 @@ async function toggleSilence(v) {
if (confirm.canceled) {
silenced = !v;
} else {
await os.api(v ? 'admin/silence-user' : 'admin/unsilence-user', { userId: user.id });
await os.api(v ? 'admin/users/silence' : 'admin/users/unsilence', { userId: user.id });
await refreshUser();
}
}
@ -208,7 +208,7 @@ async function toggleSuspend(v) {
if (confirm.canceled) {
suspended = !v;
} else {
await os.api(v ? 'admin/suspend-user' : 'admin/unsuspend-user', { userId: user.id });
await os.api(v ? 'admin/users/suspend' : 'admin/users/unsuspend', { userId: user.id });
await refreshUser();
}
}
@ -225,7 +225,7 @@ async function deleteAllFiles() {
});
if (confirm.canceled) return;
const process = async () => {
await os.api('admin/delete-all-files-of-a-user', { userId: user.id });
await os.api('admin/users/delete-all-files', { userId: user.id });
os.success();
};
await process().catch(err => {
@ -250,7 +250,7 @@ async function deleteAccount() {
if (typed.canceled) return;
if (typed.result === user?.username) {
await os.apiWithDialog('admin/accounts/delete', {
await os.apiWithDialog('admin/users/delete', {
userId: user.id,
});
} else {

View file

@ -35,7 +35,7 @@ function submit(): void {
if (submitting) return;
submitting = true;
os.api('admin/accounts/create', {
os.api('admin/users/create', {
username,
password,
}).then(res => {

View file

@ -119,7 +119,7 @@ export function getUserMenu(user) {
async function toggleSilence(): Promise<void> {
if (!await getConfirmed(i18n.t(user.isSilenced ? 'unsilenceConfirm' : 'silenceConfirm'))) return;
os.apiWithDialog(user.isSilenced ? 'admin/unsilence-user' : 'admin/silence-user', {
os.apiWithDialog(user.isSilenced ? 'admin/users/unsilence' : 'admin/users/silence', {
userId: user.id,
}).then(() => {
user.isSilenced = !user.isSilenced;
@ -129,7 +129,7 @@ export function getUserMenu(user) {
async function toggleSuspend(): Promise<void> {
if (!await getConfirmed(i18n.t(user.isSuspended ? 'unsuspendConfirm' : 'suspendConfirm'))) return;
os.apiWithDialog(user.isSuspended ? 'admin/unsuspend-user' : 'admin/suspend-user', {
os.apiWithDialog(user.isSuspended ? 'admin/users/unsuspend' : 'admin/users/suspend', {
userId: user.id,
}).then(() => {
user.isSuspended = !user.isSuspended;