feat: Allow changing instance URL when not logged in

This commit is contained in:
Xyphyn committed 2023-07-17 10:40:06 -07:00
1 parent f127b5f645
commit fed5cc2263
11 files changed
+133 -76

No files matched your search

+2 -2
View File
@@ -1,4 +1,4 @@
import { DEFAULT_INSTANCE_URL, authData } from '$lib/lemmy.js'
import { instance } from '$lib/lemmy.js'
import { error, redirect } from '@sveltejs/kit'
import { get } from 'svelte/store'
@@ -6,7 +6,7 @@ export function load({ params, url }) {
if (Number(params.instance)) {
const split = url.pathname.split('/')
split.splice(2, 0, `${get(authData)?.instance ?? DEFAULT_INSTANCE_URL}`)
split.splice(2, 0, `${get(instance)}`)
const newUrl = new URL(url)
newUrl.pathname = split.join('/')