From 3a57d2c5b4a126daa44cfed6f5a6b32db6a8ed06 Mon Sep 17 00:00:00 2001 From: Kieran Hall Date: Tue, 1 Oct 2024 17:55:11 +0200 Subject: [PATCH] Replace hook reroute Resolves #2553 --- web-wallet/src/hooks.js | 6 ------ web-wallet/src/routes/(app)/+layout.js | 3 +++ web-wallet/src/routes/(welcome)/+layout.js | 8 ++++++++ 3 files changed, 11 insertions(+), 6 deletions(-) delete mode 100644 web-wallet/src/hooks.js create mode 100644 web-wallet/src/routes/(welcome)/+layout.js diff --git a/web-wallet/src/hooks.js b/web-wallet/src/hooks.js deleted file mode 100644 index e7cadab7c1..0000000000 --- a/web-wallet/src/hooks.js +++ /dev/null @@ -1,6 +0,0 @@ -/** @type {import('@sveltejs/kit').Reroute} */ -export function reroute() { - return import.meta.env.VITE_MODE_MAINTENANCE === "true" - ? `${import.meta.env.VITE_BASE_PATH}/maintenance` - : undefined; -} diff --git a/web-wallet/src/routes/(app)/+layout.js b/web-wallet/src/routes/(app)/+layout.js index 987f241158..dae9d875c0 100644 --- a/web-wallet/src/routes/(app)/+layout.js +++ b/web-wallet/src/routes/(app)/+layout.js @@ -5,6 +5,9 @@ import walletStore from "$lib/stores/walletStore"; /** @type {import("./$types").LayoutLoad} */ export async function load() { + if (import.meta.env.VITE_MODE_MAINTENANCE === "true") { + redirect(307, "/maintenance"); + } if (!get(walletStore).initialized) { redirect(307, "/"); } diff --git a/web-wallet/src/routes/(welcome)/+layout.js b/web-wallet/src/routes/(welcome)/+layout.js new file mode 100644 index 0000000000..c6378f0484 --- /dev/null +++ b/web-wallet/src/routes/(welcome)/+layout.js @@ -0,0 +1,8 @@ +import { redirect } from "$lib/navigation"; + +/** @type {import("./$types").LayoutLoad} */ +export async function load() { + if (import.meta.env.VITE_MODE_MAINTENANCE === "true") { + redirect(307, "/maintenance"); + } +}