mirror of
https://github.com/directus/directus.git
synced 2026-01-26 04:48:30 -05:00
fix back button on item pages after login (#16218)
This commit is contained in:
@@ -42,7 +42,7 @@
|
||||
icon
|
||||
secondary
|
||||
exact
|
||||
@click="router.back()"
|
||||
@click="navigateBack"
|
||||
>
|
||||
<v-icon name="arrow_back" />
|
||||
</v-button>
|
||||
@@ -365,6 +365,16 @@ const disabledOptions = computed(() => {
|
||||
return [];
|
||||
});
|
||||
|
||||
function navigateBack() {
|
||||
const backState = router.options.history.state.back;
|
||||
if (typeof backState !== 'string' || !backState.startsWith('/login')) {
|
||||
router.back();
|
||||
return;
|
||||
}
|
||||
|
||||
router.push(`/content/${props.collection}`);
|
||||
}
|
||||
|
||||
function useBreadcrumb() {
|
||||
const breadcrumb = computed(() => [
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<files-not-found v-if="!loading && !item" />
|
||||
<private-view v-else :title="loading || !item ? t('loading') : item.title">
|
||||
<template #title-outer:prepend>
|
||||
<v-button class="header-icon" rounded icon secondary exact @click="router.back()">
|
||||
<v-button class="header-icon" rounded icon secondary exact @click="navigateBack">
|
||||
<v-icon name="arrow_back" />
|
||||
</v-button>
|
||||
</template>
|
||||
@@ -288,6 +288,20 @@ const fieldsFiltered = computed(() => {
|
||||
return fields.value.filter((field: Field) => fieldsDenyList.includes(field.field) === false);
|
||||
});
|
||||
|
||||
function navigateBack() {
|
||||
const backState = router.options.history.state.back;
|
||||
if (typeof backState !== 'string' || !backState.startsWith('/login')) {
|
||||
router.back();
|
||||
return;
|
||||
}
|
||||
|
||||
if (item?.value?.folder) {
|
||||
router.push(`/files/folders/${item.value.folder}`);
|
||||
} else {
|
||||
router.push('/files');
|
||||
}
|
||||
}
|
||||
|
||||
function useBreadcrumb() {
|
||||
const breadcrumb = computed(() => {
|
||||
if (!item?.value?.folder) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<private-view :title="title">
|
||||
<template #title-outer:prepend>
|
||||
<v-button class="header-icon" rounded icon secondary exact @click="router.back()">
|
||||
<v-button class="header-icon" rounded icon secondary exact @click="navigateBack">
|
||||
<v-icon name="arrow_back" />
|
||||
</v-button>
|
||||
</template>
|
||||
@@ -328,6 +328,7 @@ export default defineComponent({
|
||||
item,
|
||||
loading,
|
||||
isNew,
|
||||
navigateBack,
|
||||
breadcrumb,
|
||||
edits,
|
||||
hasEdits,
|
||||
@@ -369,6 +370,16 @@ export default defineComponent({
|
||||
isSavable,
|
||||
};
|
||||
|
||||
function navigateBack() {
|
||||
const backState = router.options.history.state.back;
|
||||
if (typeof backState !== 'string' || !backState.startsWith('/login')) {
|
||||
router.back();
|
||||
return;
|
||||
}
|
||||
|
||||
router.push('/users');
|
||||
}
|
||||
|
||||
function useBreadcrumb() {
|
||||
const breadcrumb = computed(() => [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user