feat: Add post uploading

This commit is contained in:
Xyphyn committed 2023-07-05 12:58:36 -07:00
1 parent 5f674d4691
commit 1842139af9
31 files changed
+560 -225

No files matched your search

+9 -1
View File
@@ -9,6 +9,14 @@ import { PUBLIC_PROXY_URL } from '$env/static/public'
export const DEFAULT_INSTANCE_URL = 'lemm.ee'
export let instance_url = writable(DEFAULT_INSTANCE_URL)
export function buildBaseUrl(instance?: string) {
if (!instance) {
instance = get(authData)?.instance ?? DEFAULT_INSTANCE_URL
}
return `${PUBLIC_PROXY_URL}/cors/${instance}`
}
export function getClient(instance?: string): LemmyHttp {
if (!instance) {
instance = get(authData)?.instance ?? DEFAULT_INSTANCE_URL
@@ -31,7 +39,7 @@ if (typeof localStorage != 'undefined') {
try {
authData.set(JSON.parse(localStorage.getItem('user') ?? ''))
} catch (error) {
localStorage.removeItem('user')
// keep authdata until we can verify that the user is infact invalid
}
}
}