2020-01-30 04:37:25 +09:00
|
|
|
<template>
|
2020-10-17 20:12:00 +09:00
|
|
|
<section class="_section">
|
2022-11-16 18:29:18 +09:00
|
|
|
<div class="_title">{{ i18n.t('_auth.shareAccess', { name: app.name }) }}</div>
|
2020-01-30 04:37:25 +09:00
|
|
|
<div class="_content">
|
|
|
|
<h2>{{ app.name }}</h2>
|
|
|
|
<p class="id">{{ app.id }}</p>
|
|
|
|
<p class="description">{{ app.description }}</p>
|
|
|
|
</div>
|
|
|
|
<div class="_content">
|
2022-11-11 07:12:44 +09:00
|
|
|
<h2>{{ i18n.ts._auth.permissionAsk }}</h2>
|
2020-01-30 04:37:25 +09:00
|
|
|
<ul>
|
2022-11-16 18:29:18 +09:00
|
|
|
<li v-for="p in app.permission" :key="p">{{ i18n.t(`_permissions.${p}`) }}</li>
|
2020-01-30 04:37:25 +09:00
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
<div class="_footer">
|
2022-11-11 07:12:44 +09:00
|
|
|
<MkButton inline @click="cancel">{{ i18n.ts.cancel }}</MkButton>
|
|
|
|
<MkButton inline primary @click="accept">{{ i18n.ts.accept }}</MkButton>
|
2020-01-30 04:37:25 +09:00
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
</template>
|
|
|
|
|
2022-07-26 04:57:19 +09:00
|
|
|
<script lang="ts" setup>
|
2020-10-17 20:12:00 +09:00
|
|
|
import { defineComponent } from 'vue';
|
2022-09-06 18:21:49 +09:00
|
|
|
import MkButton from '@/components/MkButton.vue';
|
2021-11-12 02:02:25 +09:00
|
|
|
import * as os from '@/os';
|
2022-11-11 07:12:44 +09:00
|
|
|
import { i18n } from '@/i18n';
|
2020-01-30 04:37:25 +09:00
|
|
|
|
2022-07-26 04:57:19 +09:00
|
|
|
const emit = defineEmits<{
|
|
|
|
(ev: 'denied'): void;
|
|
|
|
(ev: 'accepted'): void;
|
|
|
|
}>();
|
2020-01-30 04:37:25 +09:00
|
|
|
|
2022-07-26 04:57:19 +09:00
|
|
|
const props = defineProps<{
|
|
|
|
session: {
|
|
|
|
app: {
|
|
|
|
name: string;
|
|
|
|
id: string;
|
|
|
|
description: string;
|
|
|
|
permission: string[];
|
|
|
|
};
|
|
|
|
token: string;
|
|
|
|
};
|
|
|
|
}>();
|
|
|
|
|
|
|
|
const app = props.session.app;
|
|
|
|
|
|
|
|
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');
|
|
|
|
});
|
|
|
|
}
|
2020-01-30 04:37:25 +09:00
|
|
|
</script>
|