mirror of
https://github.com/directus/directus.git
synced 2026-01-30 01:48:27 -05:00
redirect to page not found for invalid collections (#11882)
This commit is contained in:
@@ -62,12 +62,19 @@ export default defineModule({
|
||||
async beforeEnter(to) {
|
||||
const collectionsStore = useCollectionsStore();
|
||||
const info = collectionsStore.getCollection(to.params.collection as string);
|
||||
const fieldsStore = useFieldsStore();
|
||||
|
||||
if (!info) {
|
||||
return {
|
||||
name: 'settings-not-found',
|
||||
params: { _: to.path.split('/').slice(1) },
|
||||
};
|
||||
}
|
||||
|
||||
if (!info?.meta) {
|
||||
await api.patch(`/collections/${to.params.collection}`, { meta: {} });
|
||||
}
|
||||
|
||||
const fieldsStore = useFieldsStore();
|
||||
fieldsStore.hydrate();
|
||||
},
|
||||
props: (route) => ({
|
||||
|
||||
Reference in New Issue
Block a user