forked from FoundKeyGang/FoundKey
client: adjust API endpoints for user administration
This commit is contained in:
parent
bfd1adf761
commit
2fda599a86
8 changed files with 15 additions and 15 deletions
|
@ -61,7 +61,7 @@ const emit = defineEmits<{
|
||||||
let forward = $ref(props.report.forwarded);
|
let forward = $ref(props.report.forwarded);
|
||||||
|
|
||||||
function resolve(): void {
|
function resolve(): void {
|
||||||
os.apiWithDialog('admin/resolve-abuse-user-report', {
|
os.apiWithDialog('admin/reports/resolve', {
|
||||||
forward,
|
forward,
|
||||||
reportId: props.report.id,
|
reportId: props.report.id,
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
|
|
|
@ -52,7 +52,7 @@ let reporterOrigin = $ref('combined');
|
||||||
let targetUserOrigin = $ref('combined');
|
let targetUserOrigin = $ref('combined');
|
||||||
|
|
||||||
const pagination = {
|
const pagination = {
|
||||||
endpoint: 'admin/abuse-user-reports' as const,
|
endpoint: 'admin/reports/list' as const,
|
||||||
limit: 10,
|
limit: 10,
|
||||||
params: computed(() => ({
|
params: computed(() => ({
|
||||||
state,
|
state,
|
||||||
|
|
|
@ -61,7 +61,7 @@ let noBotProtection = !instance.disableRegistration && !instance.enableHcaptcha
|
||||||
let noEmailServer = !instance.enableEmail;
|
let noEmailServer = !instance.enableEmail;
|
||||||
let thereIsUnresolvedAbuseReport = $ref(false);
|
let thereIsUnresolvedAbuseReport = $ref(false);
|
||||||
|
|
||||||
os.api('admin/abuse-user-reports', {
|
os.api('admin/reports/list', {
|
||||||
state: 'unresolved',
|
state: 'unresolved',
|
||||||
limit: 1,
|
limit: 1,
|
||||||
}).then(reports => {
|
}).then(reports => {
|
||||||
|
|
|
@ -71,7 +71,7 @@ let origin = $ref('local');
|
||||||
let searchUsername = $ref('');
|
let searchUsername = $ref('');
|
||||||
let searchHost = $ref('');
|
let searchHost = $ref('');
|
||||||
const pagination = {
|
const pagination = {
|
||||||
endpoint: 'admin/show-users' as const,
|
endpoint: 'admin/users' as const,
|
||||||
limit: 10,
|
limit: 10,
|
||||||
params: computed(() => ({
|
params: computed(() => ({
|
||||||
sort,
|
sort,
|
||||||
|
@ -101,7 +101,7 @@ async function addUser(): Promise<void> {
|
||||||
});
|
});
|
||||||
if (canceled2) return;
|
if (canceled2) return;
|
||||||
|
|
||||||
os.apiWithDialog('admin/accounts/create', {
|
os.apiWithDialog('admin/users/create', {
|
||||||
username,
|
username,
|
||||||
password,
|
password,
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
|
|
|
@ -166,7 +166,7 @@ let suspended = $ref(false);
|
||||||
let isBlocked = $ref(false);
|
let isBlocked = $ref(false);
|
||||||
|
|
||||||
const usersPagination = {
|
const usersPagination = {
|
||||||
endpoint: iAmModerator ? 'admin/show-users' : 'users' as const,
|
endpoint: iAmModerator ? 'admin/users' : 'users' as const,
|
||||||
limit: 10,
|
limit: 10,
|
||||||
params: {
|
params: {
|
||||||
sort: '+updatedAt',
|
sort: '+updatedAt',
|
||||||
|
|
|
@ -149,7 +149,7 @@ function createFetcher() {
|
||||||
if (iAmModerator) {
|
if (iAmModerator) {
|
||||||
return () => Promise.all([os.api('users/show', {
|
return () => Promise.all([os.api('users/show', {
|
||||||
userId: props.userId,
|
userId: props.userId,
|
||||||
}), os.api('admin/show-user', {
|
}), os.api('admin/users/show', {
|
||||||
userId: props.userId,
|
userId: props.userId,
|
||||||
})]).then(([_user, _info]) => {
|
})]).then(([_user, _info]) => {
|
||||||
user = _user;
|
user = _user;
|
||||||
|
@ -177,7 +177,7 @@ async function updateRemoteUser() {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function resetPassword() {
|
async function resetPassword() {
|
||||||
const { password } = await os.api('admin/reset-password', {
|
const { password } = await os.api('admin/users/reset-password', {
|
||||||
userId: user.id,
|
userId: user.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@ async function toggleSilence(v) {
|
||||||
if (confirm.canceled) {
|
if (confirm.canceled) {
|
||||||
silenced = !v;
|
silenced = !v;
|
||||||
} else {
|
} 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();
|
await refreshUser();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -208,7 +208,7 @@ async function toggleSuspend(v) {
|
||||||
if (confirm.canceled) {
|
if (confirm.canceled) {
|
||||||
suspended = !v;
|
suspended = !v;
|
||||||
} else {
|
} 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();
|
await refreshUser();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -225,7 +225,7 @@ async function deleteAllFiles() {
|
||||||
});
|
});
|
||||||
if (confirm.canceled) return;
|
if (confirm.canceled) return;
|
||||||
const process = async () => {
|
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();
|
os.success();
|
||||||
};
|
};
|
||||||
await process().catch(err => {
|
await process().catch(err => {
|
||||||
|
@ -250,7 +250,7 @@ async function deleteAccount() {
|
||||||
if (typed.canceled) return;
|
if (typed.canceled) return;
|
||||||
|
|
||||||
if (typed.result === user?.username) {
|
if (typed.result === user?.username) {
|
||||||
await os.apiWithDialog('admin/accounts/delete', {
|
await os.apiWithDialog('admin/users/delete', {
|
||||||
userId: user.id,
|
userId: user.id,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -35,7 +35,7 @@ function submit(): void {
|
||||||
if (submitting) return;
|
if (submitting) return;
|
||||||
submitting = true;
|
submitting = true;
|
||||||
|
|
||||||
os.api('admin/accounts/create', {
|
os.api('admin/users/create', {
|
||||||
username,
|
username,
|
||||||
password,
|
password,
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
|
|
|
@ -119,7 +119,7 @@ export function getUserMenu(user) {
|
||||||
async function toggleSilence(): Promise<void> {
|
async function toggleSilence(): Promise<void> {
|
||||||
if (!await getConfirmed(i18n.t(user.isSilenced ? 'unsilenceConfirm' : 'silenceConfirm'))) return;
|
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,
|
userId: user.id,
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
user.isSilenced = !user.isSilenced;
|
user.isSilenced = !user.isSilenced;
|
||||||
|
@ -129,7 +129,7 @@ export function getUserMenu(user) {
|
||||||
async function toggleSuspend(): Promise<void> {
|
async function toggleSuspend(): Promise<void> {
|
||||||
if (!await getConfirmed(i18n.t(user.isSuspended ? 'unsuspendConfirm' : 'suspendConfirm'))) return;
|
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,
|
userId: user.id,
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
user.isSuspended = !user.isSuspended;
|
user.isSuspended = !user.isSuspended;
|
||||||
|
|
Loading…
Reference in a new issue