15 lines
765 B
TypeScript
15 lines
765 B
TypeScript
// PEP-160: what a create form gets back from its server action, and where the user lands.
|
|
|
|
/** Result of a create form: an error to show next to the button, or the page with the new record. */
|
|
export type FormResult = { error: string } | { to: string };
|
|
|
|
/**
|
|
* The board that shows a just-created task: the epic filter the task was created from stays only
|
|
* when the task belongs to that epic — otherwise the filter would hide the new card.
|
|
*/
|
|
export function boardAfterCreate(projectKey: string, taskKey: string, taskEpicId?: number | null, filterEpicId?: number | null): string {
|
|
const q = new URLSearchParams({ added: taskKey });
|
|
if (filterEpicId && taskEpicId === filterEpicId) q.set("epic", String(filterEpicId));
|
|
return `/p/${projectKey}?${q}`;
|
|
}
|