2019-12-20 13:04:34 +01:00
|
|
|
<template>
|
2022-07-12 10:55:28 +02:00
|
|
|
<div class="container mx-auto px-2">
|
|
|
|
<h1>{{ t("Terms") }}</h1>
|
|
|
|
<o-loading v-model="termsLoading" />
|
|
|
|
<div
|
|
|
|
class="prose dark:prose-invert"
|
|
|
|
v-if="config"
|
|
|
|
v-html="config.terms.bodyHtml"
|
|
|
|
/>
|
2020-02-18 08:57:00 +01:00
|
|
|
</div>
|
2019-12-20 13:04:34 +01:00
|
|
|
</template>
|
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
<script lang="ts" setup>
|
2020-02-18 08:57:00 +01:00
|
|
|
import { TERMS } from "@/graphql/config";
|
|
|
|
import { IConfig } from "@/types/config.model";
|
2020-11-27 19:27:44 +01:00
|
|
|
import { InstanceTermsType } from "@/types/enums";
|
2022-07-12 10:55:28 +02:00
|
|
|
import { useQuery } from "@vue/apollo-composable";
|
|
|
|
import { useHead } from "@vueuse/head";
|
|
|
|
import { computed, watch } from "vue";
|
|
|
|
import { useI18n } from "vue-i18n";
|
2019-12-20 13:04:34 +01:00
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
const { t, locale } = useI18n({ useScope: "global" });
|
2020-02-18 08:57:00 +01:00
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
const { result: termsResult, loading: termsLoading } = useQuery<{
|
|
|
|
config: IConfig;
|
|
|
|
}>(
|
|
|
|
TERMS,
|
|
|
|
() => ({
|
|
|
|
locale: locale.value,
|
|
|
|
}),
|
|
|
|
() => ({
|
|
|
|
enabled: locale.value !== undefined,
|
|
|
|
})
|
|
|
|
);
|
2019-12-20 13:04:34 +01:00
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
const config = computed(() => termsResult.value?.config);
|
2019-12-20 13:04:34 +01:00
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
watch(config, () => {
|
|
|
|
if (config.value?.terms?.type) {
|
|
|
|
redirectToUrl();
|
2019-12-20 13:04:34 +01:00
|
|
|
}
|
2022-07-12 10:55:28 +02:00
|
|
|
});
|
2019-12-20 13:04:34 +01:00
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
const redirectToUrl = (): void => {
|
|
|
|
if (config.value?.terms?.type === InstanceTermsType.URL) {
|
|
|
|
window.location.replace(config.value?.terms?.url);
|
2019-12-20 13:04:34 +01:00
|
|
|
}
|
2022-07-12 10:55:28 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
useHead({
|
|
|
|
title: computed(() => t("Terms")),
|
|
|
|
});
|
2019-12-20 13:04:34 +01:00
|
|
|
</script>
|