Skip to content

Commit

Permalink
feat: redirect to newly created risk assessment
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohamed-Hacene committed Dec 16, 2024
1 parent 618574e commit 1c81f05
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -146,6 +150,10 @@
}
modalStore.trigger(modal);
}
$: if (form && form.redirect) {
goto(getSecureRedirect(form.redirect));
}
</script>

<div class="h-full w-full p-8">
Expand Down

0 comments on commit 1c81f05

Please sign in to comment.