mirror of
https://github.com/kokonect-link/cherrypick
synced 2024-12-19 00:58:58 +09:00
60 lines
1.1 KiB
Vue
60 lines
1.1 KiB
Vue
|
<template>
|
||
|
<section class="_section">
|
||
|
<div class="_content">
|
||
|
<MkButton @click="generateToken">{{ $t('generateAccessToken') }}</MkButton>
|
||
|
</div>
|
||
|
</section>
|
||
|
</template>
|
||
|
|
||
|
<script lang="ts">
|
||
|
import { defineComponent } from 'vue';
|
||
|
import { faKey } from '@fortawesome/free-solid-svg-icons';
|
||
|
import MkButton from '@/components/ui/button.vue';
|
||
|
import MkInput from '@/components/ui/input.vue';
|
||
|
import * as os from '@/os';
|
||
|
|
||
|
export default defineComponent({
|
||
|
components: {
|
||
|
MkButton, MkInput
|
||
|
},
|
||
|
|
||
|
emits: ['info'],
|
||
|
|
||
|
data() {
|
||
|
return {
|
||
|
INFO: {
|
||
|
header: [{
|
||
|
title: 'API',
|
||
|
icon: faKey
|
||
|
}]
|
||
|
},
|
||
|
};
|
||
|
},
|
||
|
|
||
|
mounted() {
|
||
|
this.$emit('info', this.INFO);
|
||
|
},
|
||
|
|
||
|
methods: {
|
||
|
async generateToken() {
|
||
|
os.popup(await import('@/components/token-generate-window.vue'), {}, {
|
||
|
done: async result => {
|
||
|
const { name, permissions } = result;
|
||
|
const { token } = await os.api('miauth/gen-token', {
|
||
|
session: null,
|
||
|
name: name,
|
||
|
permission: permissions,
|
||
|
});
|
||
|
|
||
|
os.dialog({
|
||
|
type: 'success',
|
||
|
title: this.$t('token'),
|
||
|
text: token
|
||
|
});
|
||
|
},
|
||
|
}, 'closed');
|
||
|
},
|
||
|
}
|
||
|
});
|
||
|
</script>
|