// Writing from a page, as whoever is logged in to it: the write, then the // page's answers asked again, so it shows what was written. import { invalidateAll } from '$app/navigation'; /** * Runs `write`, then has the page ask its answers again: nothing once * done, or why it failed, in the server's words. */ export async function written(write: () => Promise): Promise { try { await write(); } catch (e) { return e instanceof Error ? e.message : String(e); } await invalidateAll(); return undefined; }