implemented dynamic theme loading, working on user edit
This commit is contained in:
@@ -9,12 +9,22 @@
|
||||
import User from "./routes/user/User.svelte";
|
||||
|
||||
|
||||
let translations_ready = false;
|
||||
let translations_ready = $state(false);
|
||||
onMount(async () => {
|
||||
await loadTranslation('de','Login');
|
||||
translations_ready = true;
|
||||
});
|
||||
|
||||
function loadTheme(name){
|
||||
if (!name) return;
|
||||
console.log({theme:name});
|
||||
const url = `${location.protocol}//${location.host.replace('5173','8080')}/css/${name}.css`;
|
||||
fetch(url).then(resp => resp.text()).then(css => {
|
||||
document.getElementById('usercss').innerText = css;
|
||||
});
|
||||
}
|
||||
|
||||
$effect(() => loadTheme(user.theme));
|
||||
</script>
|
||||
|
||||
{#if translations_ready }
|
||||
|
||||
Reference in New Issue
Block a user