lora-studio / src /lib /components /UserIsLogged.svelte
enzostvs's picture
enzostvs HF staff
user is logged in front check
a1d7896
raw
history blame
570 Bytes
<script lang="ts">
import { get } from "svelte/store";
import { loginModalStore } from "$lib/stores/use-login-modal";
import { userStore } from "$lib/stores/use-user";
let user = get(userStore);
const handleClick = (e: any) => {
if (!user) {
loginModalStore.update(() => true);
}
};
</script>
<!-- svelte-ignore a11y-no-static-element-interactions -->
<!-- svelte-ignore a11y-click-events-have-key-events -->
<div
class="w-full cursor-pointer"
on:click={handleClick}
>
<div class:pointer-events-none={!user}>
<slot />
</div>
</div>