Redirect to page not found for non-existent flows (#13905)

This commit is contained in:
Azri Kahar
2022-06-15 21:50:17 +08:00
committed by GitHub
parent 7cefbc9430
commit bd18b2e781

View File

@@ -1,6 +1,6 @@
import api from '@/api';
import { defineModule } from '@directus/shared/utils';
import { useCollectionsStore, useFieldsStore } from '@/stores';
import { useCollectionsStore, useFieldsStore, useFlowsStore } from '@/stores';
import RouterPass from '@/utils/router-passthrough';
import Collections from './routes/data-model/collections/collections.vue';
import FieldDetail from './routes/data-model/field-detail/field-detail.vue';
@@ -193,6 +193,16 @@ export default defineModule({
path: ':primaryKey',
component: FlowsDetail,
props: true,
async beforeEnter(to) {
const { flows } = useFlowsStore();
const existingFlow = flows.find((flow) => flow.id === to.params.primaryKey);
if (!existingFlow) {
return {
name: 'settings-not-found',
params: { _: to.path.split('/').slice(1) },
};
}
},
children: [
{
name: 'settings-flows-operation',