prompt to confirm before revoking token
This commit is contained in:
parent
5742aade4c
commit
ac576ca7fc
1 changed files with 17 additions and 3 deletions
|
|
@ -67,6 +67,8 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import * as os from '@/os.js';
|
||||
import FormPagination from '@/components/MkPagination.vue';
|
||||
import { misskeyApi } from '@/utility/misskey-api.js';
|
||||
import { i18n } from '@/i18n.js';
|
||||
|
|
@ -87,9 +89,21 @@ const pagination = {
|
|||
},
|
||||
};
|
||||
|
||||
function revoke(token) {
|
||||
misskeyApi('i/revoke-token', { tokenId: token.id }).then(() => {
|
||||
list.value?.reload();
|
||||
async function revoke(token: Misskey.entities.IAppsResponse[number]) {
|
||||
const { canceled } = await os.confirm({
|
||||
type: 'question',
|
||||
text: token.grantees.length > 0
|
||||
? i18n.tsx.confirmRevokeSharedToken({ num: token.grantees.length })
|
||||
: i18n.ts.confirmRevokeToken,
|
||||
okText: i18n.ts.yes,
|
||||
cancelText: i18n.ts.no,
|
||||
});
|
||||
if (canceled) return;
|
||||
|
||||
await os.promiseDialog(async () => {
|
||||
await misskeyApi('i/revoke-token', { tokenId: token.id });
|
||||
|
||||
await list.value?.reload();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue