Skip to content

Commit be66744

Browse files
committed
remove unecessery func
1 parent bf12a70 commit be66744

File tree

5 files changed

+15
-23
lines changed

5 files changed

+15
-23
lines changed

.example.env

-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
VITE_SUPABASE_URL=https://<redacted>.supabase.co
22
VITE_SUPABASE_ANON_KEY=<redacted>
3-
PUBLIC_BASE_URL=http://localhost:3000

src/lib/util.js

+7
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,10 @@ export function ipInfo(ip) {
99
const url = "http://www.geoplugin.net/json.gp?ip=" + ip;
1010
return fetch(url).then((response) => response.json());
1111
}
12+
13+
/**
14+
* @param {string} name
15+
*/
16+
export function link(name) {
17+
return "/login?next" + encodeURIComponent("=" + name + "?");
18+
}

src/routes/+layout.svelte

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<script>
2-
import Header from "./Header.svelte";
32
import "./styles.css";
43
import "@fontsource/lato";
54
import "@fontsource/raleway/500.css";
5+
import Header from "./Header.svelte";
66
</script>
77

88
<div class="app">

src/routes/Header.svelte

+3-12
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,9 @@
11
<script>
22
// @ts-nocheck
3-
4-
import { PUBLIC_BASE_URL } from "$env/static/public";
5-
import { mustLogIn } from "./store.js";
63
import "@fontsource/lato/300.css";
74
import "@fontsource/lato/400.css";
8-
9-
function link(name) {
10-
return PUBLIC_BASE_URL + "/login?next" + encodeURIComponent("=" + name + "?");
11-
}
12-
13-
function normal() {
14-
return PUBLIC_BASE_URL;
15-
}
5+
import { link } from "$lib/util";
6+
import { mustLogIn } from "./store.js";
167
</script>
178

189
<header>
@@ -45,7 +36,7 @@
4536
>
4637
Register
4738
</a>
48-
<a href={normal()} on:click={() => mustLogIn.set(false)} class="log" id="login">
39+
<a href="/login" on:click={() => mustLogIn.set(false)} class="log" id="login">
4940
Login
5041
</a>
5142
</div>

src/routes/login/+page.svelte

+4-9
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
<script>
22
// @ts-nocheck
3-
43
import { browser } from "$app/environment";
5-
import { page } from "$app/stores";
6-
import { webVitals } from "$lib/vitals";
7-
import { PUBLIC_BASE_URL } from "$env/static/public";
4+
import { detectOS } from "$lib/util.js";
5+
import { link } from "$lib/util";
86
import { mustLogIn } from "../store.js";
97
import { onMount } from "svelte";
10-
import { detectOS } from "$lib/util.js";
11-
12-
function link(name) {
13-
return PUBLIC_BASE_URL + "/login?next" + encodeURIComponent("=" + name + "?");
14-
}
8+
import { page } from "$app/stores";
9+
import { webVitals } from "$lib/vitals";
1510
1611
let loaded = false;
1712

0 commit comments

Comments
 (0)