1
0
mirror of https://github.com/MisskeyIO/misskey synced 2024-12-25 12:08:16 +09:00
MisskeyIO/packages/frontend/src/pages/auth.form.vue

67 lines
1.4 KiB
Vue
Raw Normal View History

<template>
<section>
<div v-if="app.permission.length > 0">
2023-02-10 02:29:22 +09:00
<p>{{ $t('_auth.permission', { name }) }}</p>
<ul>
<li v-for="p in app.permission" :key="p">{{ $t(`_permissions.${p}`) }}</li>
</ul>
</div>
<div>{{ i18n.t('_auth.shareAccess', { name: `${name} (${app.id})` }) }}</div>
<div :class="$style.buttons">
<MkButton inline @click="cancel">{{ i18n.ts.cancel }}</MkButton>
<MkButton inline primary @click="accept">{{ i18n.ts.accept }}</MkButton>
</div>
</section>
</template>
<script lang="ts" setup>
import { } from 'vue';
import MkButton from '@/components/MkButton.vue';
2021-11-12 02:02:25 +09:00
import * as os from '@/os';
import { i18n } from '@/i18n';
import { AuthSession } from 'misskey-js/built/entities';
const props = defineProps<{
session: AuthSession;
}>();
const emit = defineEmits<{
(event: 'accepted'): void;
(event: 'denied'): void;
}>();
const app = $computed(() => props.session.app);
const name = $computed(() => {
const el = document.createElement('div');
el.textContent = app.name;
return el.innerHTML;
});
function cancel() {
os.api('auth/deny', {
token: props.session.token,
}).then(() => {
emit('denied');
});
}
function accept() {
os.api('auth/accept', {
token: props.session.token,
}).then(() => {
emit('accepted');
});
}
</script>
<style lang="scss" module>
.buttons {
margin-top: 16px;
display: flex;
gap: 8px;
flex-wrap: wrap;
}
</style>