1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2024-12-25 20:18:23 +09:00
cherrypick/src/client/app/desktop/views/pages/admin/admin.suspend-user.vue

40 lines
741 B
Vue
Raw Normal View History

2018-08-14 01:05:58 +09:00
<template>
<div>
<header>%i18n:@suspend-user%</header>
<input v-model="username"/>
<button @click="suspendUser" :disabled="suspending">%i18n:@suspend%</button>
</div>
</template>
<script lang="ts">
import Vue from "vue";
import parseAcct from "../../../../../../misc/acct/parse";
export default Vue.extend({
2018-08-14 01:48:11 +09:00
data() {
return {
username: null,
suspending: false
};
},
methods: {
async suspendUser() {
this.suspending = true;
2018-08-14 01:05:58 +09:00
2018-08-14 01:48:11 +09:00
const user = await (this as any).os.api(
"users/show",
parseAcct(this.username)
);
2018-08-14 01:05:58 +09:00
2018-08-14 01:48:11 +09:00
await (this as any).os.api("admin/suspend-user", {
userId: user.id
});
2018-08-14 01:05:58 +09:00
2018-08-14 01:48:11 +09:00
this.suspending = false;
2018-08-14 01:05:58 +09:00
2018-08-14 01:48:11 +09:00
(this as any).os.apis.dialog({ text: "%i18n:@suspended%" });
}
}
2018-08-14 01:05:58 +09:00
});
</script>