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