diff --git a/frontend/src/routes/(app)/(internal)/ebios-rm/[id=uuid]/+page.server.ts b/frontend/src/routes/(app)/(internal)/ebios-rm/[id=uuid]/+page.server.ts index 06293b581..ad26bedfc 100644 --- a/frontend/src/routes/(app)/(internal)/ebios-rm/[id=uuid]/+page.server.ts +++ b/frontend/src/routes/(app)/(internal)/ebios-rm/[id=uuid]/+page.server.ts @@ -33,12 +33,11 @@ export const load: PageServerLoad = async ({ params, fetch }) => { export const actions: Actions = { create: async (event) => { - // const redirectToWrittenObject = Boolean(event.params.model === 'entity-assessments'); return defaultWriteFormAction({ event, urlModel: 'risk-assessments', - action: 'create' - // redirectToWrittenObject: redirectToWrittenObject + action: 'create', + redirectToWrittenObject: true }); } }; diff --git a/frontend/src/routes/(app)/(internal)/ebios-rm/[id=uuid]/+page.svelte b/frontend/src/routes/(app)/(internal)/ebios-rm/[id=uuid]/+page.svelte index 1c99e6677..baa5afe9a 100644 --- a/frontend/src/routes/(app)/(internal)/ebios-rm/[id=uuid]/+page.svelte +++ b/frontend/src/routes/(app)/(internal)/ebios-rm/[id=uuid]/+page.svelte @@ -3,16 +3,20 @@ import { safeTranslate } from '$lib/utils/i18n'; import Tile from './Tile.svelte'; import { page } from '$app/stores'; - import type { PageData } from './$types'; + import type { PageData, ActionData } from './$types'; import { breadcrumbObject } from '$lib/utils/stores'; import type { ModalComponent, ModalSettings, ModalStore } from '@skeletonlabs/skeleton'; import { getModalStore } from '@skeletonlabs/skeleton'; import CreateModal from '$lib/components/Modals/CreateModal.svelte'; import MissingConstraintsModal from '$lib/components/Modals/MissingConstraintsModal.svelte'; import { checkConstraints } from '$lib/utils/crud'; + import { goto } from '$app/navigation'; + import { getSecureRedirect } from '$lib/utils/helpers'; + const modalStore: ModalStore = getModalStore(); export let data: PageData; + export let form: ActionData; $: breadcrumbObject.set(data.data); @@ -146,6 +150,10 @@ } modalStore.trigger(modal); } + + $: if (form && form.redirect) { + goto(getSecureRedirect(form.redirect)); + }