fixing licence missing edge case

This commit is contained in:
Alex
2025-03-02 23:57:52 +01:00
parent 60a12c97be
commit f5df70fba8

View File

@@ -6,6 +6,7 @@
import { hasPrivilige, receive, send } from '$lib/utils/helpers'; import { hasPrivilige, receive, send } from '$lib/utils/helpers';
import { t } from 'svelte-i18n'; import { t } from 'svelte-i18n';
import { PERMISSIONS } from '$lib/utils/constants'; import { PERMISSIONS } from '$lib/utils/constants';
import { defaultLicence } from '$lib/utils/defaults';
/** @type {import('../../routes/auth/about/[id]/$types').ActionData} */ /** @type {import('../../routes/auth/about/[id]/$types').ActionData} */
export let form; export let form;
@@ -16,6 +17,11 @@
/** @type {App.Locals['user']} */ /** @type {App.Locals['user']} */
export let user; export let user;
// Ensure licence is initialized before passing to child
$: if (user && !user.licence) {
user.licence = defaultLicence();
}
/** @type {App.Locals['user']} */ /** @type {App.Locals['user']} */
export let editor; export let editor;