aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2025-02-19 20:58:54 -0800
committerAdam Soltys <[email protected]>2025-02-19 20:58:54 -0800
commitdfcc2c0acbf1820752a1710af4a9d3504ce787a4 (patch)
treec4a5083f2a04b48049121e3e6b1274857c8844eb /src
parentb155c546bd261444e639345074e2b5152363f0bc (diff)
downloadcoinos-ui-dfcc2c0acbf1820752a1710af4a9d3504ce787a4.tar.gz
coinos-ui-dfcc2c0acbf1820752a1710af4a9d3504ce787a4.zip
redirect for apps/new
Diffstat (limited to 'src')
-rw-r--r--src/routes/(app)/apps/new/+page.server.ts9
-rw-r--r--src/routes/(static)/login/+page.svelte2
-rw-r--r--src/routes/(static)/register/+page.svelte2
3 files changed, 10 insertions, 3 deletions
diff --git a/src/routes/(app)/apps/new/+page.server.ts b/src/routes/(app)/apps/new/+page.server.ts
index 7c335f8c..3fe18128 100644
--- a/src/routes/(app)/apps/new/+page.server.ts
+++ b/src/routes/(app)/apps/new/+page.server.ts
@@ -3,6 +3,14 @@ import { auth, fd, post } from "$lib/utils";
import { fail, redirect } from "@sveltejs/kit";
export const load = async ({ parent, url }) => {
+ const { user } = await parent();
+
+ if (!user)
+ redirect(
+ 307,
+ `/register?redirect=${encodeURIComponent(url.pathname + url.search)}`,
+ );
+
const app = {
name: url.searchParams.get("name"),
pubkey: url.searchParams.get("pubkey"),
@@ -10,7 +18,6 @@ export const load = async ({ parent, url }) => {
budget_renewal: url.searchParams.get("budget_renewal"),
};
- const { user } = await parent();
const rates = await getRates();
const rate = rates[user.currency];
return { app, rate };
diff --git a/src/routes/(static)/login/+page.svelte b/src/routes/(static)/login/+page.svelte
index 6b8820ea..1a1f745c 100644
--- a/src/routes/(static)/login/+page.svelte
+++ b/src/routes/(static)/login/+page.svelte
@@ -179,7 +179,7 @@
<p class="text-secondary text-center font-medium">
{$t("login.noAccount")}
<a
- href={"/register"}
+ href={"/register" + $page.url.search}
class="block md:inline text-secondary underline underline-offset-4 hover:opacity-80"
>
{$t("login.register")}
diff --git a/src/routes/(static)/register/+page.svelte b/src/routes/(static)/register/+page.svelte
index 27b151d9..19fd5c76 100644
--- a/src/routes/(static)/register/+page.svelte
+++ b/src/routes/(static)/register/+page.svelte
@@ -333,7 +333,7 @@
<p class="text-secondary text-center font-medium">
{$t("login.haveAccount")}
<a
- href={"/login"}
+ href={"/login" + $page.url.search}
class="block md:inline text-secondary underline underline-offset-4 hover:opacity-80"
>
{$t("login.signIn")}