内部routerで遷移した場合には正規ページに転送するように

This commit is contained in:
kakkokari-gtyih 2024-06-07 16:03:30 +09:00
parent 9a61944331
commit 6fdb004d48
3 changed files with 27 additions and 15 deletions

View file

@ -40,7 +40,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script setup lang="ts">
import { ref, computed, shallowRef, inject } from 'vue';
import { ref, computed, shallowRef, inject, onActivated } from 'vue';
import * as Misskey from 'misskey-js';
import MkNotes from '@/components/MkNotes.vue';
import XNotFound from '@/pages/not-found.vue';
@ -60,12 +60,16 @@ const props = defineProps<{
enableAutoLoad?: string;
}>();
const inEmbedPage = inject<boolean>('EMBED_PAGE', false);
function redirectIfNotEmbedPage() {
const inEmbedPage = inject<boolean>('EMBED_PAGE', false);
if (!inEmbedPage) {
const router = useRouter();
router.replace(`/clips/${props.clipId}`);
if (!inEmbedPage) {
const router = useRouter();
router.replace(`/clips/${props.clipId}`);
}
}
redirectIfNotEmbedPage();
onActivated(redirectIfNotEmbedPage);
// : true
const normalizedShowHeader = computed(() => props.showHeader !== 'false');