toggle fix

This commit is contained in:
nomadics9 2024-05-12 07:27:41 +03:00
parent c77a9d26d1
commit 7447155764

View file

@ -1,5 +1,4 @@
<script lang="ts"> <script lang="ts">
import { page } from "$app/stores";
import { db, user, userData } from "$lib/firebase"; import { db, user, userData } from "$lib/firebase";
import { import {
arrayRemove, arrayRemove,
@ -93,13 +92,12 @@
let publish = $userData?.published let publish = $userData?.published
function togglePublish() { function togglePublish() {
publish = !$userData?.published publish == !publish
const userRef = doc(db, "users", $user!.uid); const userRef = doc(db, "users", $user!.uid);
updateDoc(userRef, { updateDoc(userRef, {
published: publish published: publish
}); });
} }
publish == $userData?.published
function moveUp(index: any) { function moveUp(index: any) {
@ -235,7 +233,7 @@
<div class="form-control"> <div class="form-control">
<label class="label cursor-pointer"> <label class="label cursor-pointer">
<span class="label-text">Published</span> <span class="label-text">Published</span>
<input type="checkbox" class="toggle" bind:value={publish} on:change={togglePublish}/> <input type="checkbox" class="toggle" bind:checked={publish} on:change={togglePublish}/>
</label> </label>
</div> </div>
{/if} {/if}