内部routerで遷移した場合には正規ページに転送するように
This commit is contained in:
parent
9a61944331
commit
6fdb004d48
|
@ -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');
|
||||
|
|
|
@ -12,7 +12,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, provide, inject } from 'vue';
|
||||
import { ref, provide, inject, onActivated } from 'vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import MkNoteDetailed from '@/components/MkNoteDetailed.vue';
|
||||
import XNotFound from '@/pages/not-found.vue';
|
||||
|
@ -24,12 +24,16 @@ const props = defineProps<{
|
|||
noteId: string;
|
||||
}>();
|
||||
|
||||
const inEmbedPage = inject<boolean>('EMBED_PAGE', false);
|
||||
function redirectIfNotEmbedPage() {
|
||||
const inEmbedPage = inject<boolean>('EMBED_PAGE', false);
|
||||
|
||||
if (!inEmbedPage) {
|
||||
const router = useRouter();
|
||||
router.replace(`/notes/${props.noteId}`);
|
||||
if (!inEmbedPage) {
|
||||
const router = useRouter();
|
||||
router.replace(`/notes/${props.noteId}`);
|
||||
}
|
||||
}
|
||||
redirectIfNotEmbedPage();
|
||||
onActivated(redirectIfNotEmbedPage);
|
||||
|
||||
provide('EMBED_ORIGINAL_ENTITY_URL', `${url}/notes/${props.noteId}`);
|
||||
|
||||
|
|
|
@ -46,7 +46,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';
|
||||
|
@ -66,12 +66,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(`/@${props.username}`);
|
||||
if (!inEmbedPage) {
|
||||
const router = useRouter();
|
||||
router.replace(`/@${props.username}`);
|
||||
}
|
||||
}
|
||||
redirectIfNotEmbedPage();
|
||||
onActivated(redirectIfNotEmbedPage);
|
||||
|
||||
// デフォルト: true
|
||||
const normalizedShowHeader = computed(() => props.showHeader !== 'false');
|
||||
|
|
Loading…
Reference in a new issue