2020-01-30 04:37:25 +09:00
|
|
|
<template>
|
2023-04-08 09:01:42 +09:00
|
|
|
<section class="_section">
|
|
|
|
<div class="_title">
|
|
|
|
{{ i18n.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">
|
|
|
|
<h2>{{ i18n.ts._auth.permissionAsk }}</h2>
|
|
|
|
<ul>
|
|
|
|
<li v-for="p in app.permission" :key="p">
|
|
|
|
{{ i18n.t(`_permissions.${p}`) }}
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
<div class="_footer">
|
|
|
|
<MkButton inline @click="cancel">{{ i18n.ts.cancel }}</MkButton>
|
|
|
|
<MkButton inline primary @click="accept">{{
|
|
|
|
i18n.ts.accept
|
|
|
|
}}</MkButton>
|
|
|
|
</div>
|
|
|
|
</section>
|
2020-01-30 04:37:25 +09:00
|
|
|
</template>
|
|
|
|
|
2022-07-26 04:57:19 +09:00
|
|
|
<script lang="ts" setup>
|
2023-04-08 09:01:42 +09:00
|
|
|
import { defineComponent } from "vue";
|
|
|
|
import MkButton from "@/components/MkButton.vue";
|
|
|
|
import * as os from "@/os";
|
|
|
|
import { i18n } from "@/i18n";
|
2020-01-30 04:37:25 +09:00
|
|
|
|
2022-07-26 04:57:19 +09:00
|
|
|
const emit = defineEmits<{
|
2023-04-08 09:01:42 +09:00
|
|
|
(ev: "denied"): void;
|
|
|
|
(ev: "accepted"): void;
|
2022-07-26 04:57:19 +09:00
|
|
|
}>();
|
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() {
|
2023-04-08 09:01:42 +09:00
|
|
|
os.api("auth/deny", {
|
2022-07-26 04:57:19 +09:00
|
|
|
token: props.session.token,
|
|
|
|
}).then(() => {
|
2023-04-08 09:01:42 +09:00
|
|
|
emit("denied");
|
2022-07-26 04:57:19 +09:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function accept() {
|
2023-04-08 09:01:42 +09:00
|
|
|
os.api("auth/accept", {
|
2022-07-26 04:57:19 +09:00
|
|
|
token: props.session.token,
|
|
|
|
}).then(() => {
|
2023-04-08 09:01:42 +09:00
|
|
|
emit("accepted");
|
2022-07-26 04:57:19 +09:00
|
|
|
});
|
|
|
|
}
|
2020-01-30 04:37:25 +09:00
|
|
|
</script>
|