chore: lint on SkApprovalUser

This commit is contained in:
Mar0xy 2023-10-20 00:13:21 +02:00
parent fd8fa9b3de
commit 537af45e71
No known key found for this signature in database
GPG key ID: 56569BBE47D2C828

View file

@ -19,8 +19,8 @@
</div> </div>
</div> </div>
<div :class="$style.buttons"> <div :class="$style.buttons">
<MkButton inline success @click="approveAccount(user)">{{ i18n.ts.approveAccount }}</MkButton> <MkButton inline success @click="approveAccount()">{{ i18n.ts.approveAccount }}</MkButton>
<MkButton inline danger @click="deleteAccount(user)">{{ i18n.ts.denyAccount }}</MkButton> <MkButton inline danger @click="deleteAccount()">{{ i18n.ts.denyAccount }}</MkButton>
</div> </div>
</div> </div>
</MkFolder> </MkFolder>
@ -54,7 +54,7 @@ const emits = defineEmits<{
(event: 'deleted', value: string): void; (event: 'deleted', value: string): void;
}>(); }>();
async function deleteAccount(user) { async function deleteAccount() {
const confirm = await os.confirm({ const confirm = await os.confirm({
type: 'warning', type: 'warning',
text: i18n.ts.deleteAccountConfirm, text: i18n.ts.deleteAccountConfirm,
@ -62,15 +62,15 @@ async function deleteAccount(user) {
if (confirm.canceled) return; if (confirm.canceled) return;
const typed = await os.inputText({ const typed = await os.inputText({
text: i18n.t('typeToConfirm', { x: user?.username }), text: i18n.t('typeToConfirm', { x: props.user.username }),
}); });
if (typed.canceled) return; if (typed.canceled) return;
if (typed.result === user?.username) { if (typed.result === props.user.username) {
await os.apiWithDialog('admin/delete-account', { await os.apiWithDialog('admin/delete-account', {
userId: user.id, userId: props.user.id,
}); });
emits('deleted', user.id); emits('deleted', props.user.id);
} else { } else {
os.alert({ os.alert({
type: 'error', type: 'error',
@ -79,14 +79,14 @@ async function deleteAccount(user) {
} }
} }
async function approveAccount(user) { async function approveAccount() {
const confirm = await os.confirm({ const confirm = await os.confirm({
type: 'warning', type: 'warning',
text: i18n.ts.approveConfirm, text: i18n.ts.approveConfirm,
}); });
if (confirm.canceled) return; if (confirm.canceled) return;
await os.api('admin/approve-user', { userId: user.id }); await os.api('admin/approve-user', { userId: props.user.id });
emits('deleted', user.id); emits('deleted', props.user.id);
} }
</script> </script>
@ -111,4 +111,4 @@ async function approveAccount(user) {
display: flex; display: flex;
gap: 8px; gap: 8px;
} }
</style> </style>