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