lora-studio / src /lib /components /UserIsLogged.svelte
enzostvs's picture
enzostvs HF staff
autosubscribe user store
10926a7
raw
history blame
570 Bytes
<script lang="ts">
import { loginModalStore } from "$lib/stores/use-login-modal";
import { userStore } from "$lib/stores/use-user";
const handleClick = (e: any) => {
e.preventDefault();
e.stopPropagation();
if (!$userStore) {
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 block"
on:click={handleClick}
>
<div class:pointer-events-none={!$userStore}>
<slot />
</div>
</div>