From a5251afb0e87b72473dabdc1ec4617e8695ac764 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 21 Aug 2024 01:02:06 -0700 Subject: revamp payment totals --- src/lib/handler.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/lib/handler.js (limited to 'src/lib') diff --git a/src/lib/handler.js b/src/lib/handler.js new file mode 100644 index 00000000..05e484ec --- /dev/null +++ b/src/lib/handler.js @@ -0,0 +1,14 @@ +import { goto } from "$app/navigation"; +import { applyAction } from "$app/forms"; + +export default (submitting) => + ({ formElement, formData, action, cancel }) => { + submitting = true; + return async ({ result }) => { + if (result.type === "redirect") { + goto(result.location); + } else { + await applyAction(result); + } + }; + }; -- cgit v1.2.3