document.addEventListener('DOMContentLoaded', () => {
    const logo = document.getElementById('logo');
    const isDark = document.documentElement.classList.contains('dark');
    logo.src = isDark
        ? '/helper/dashboard/assets/images/logo-white.png'
        : '/helper/dashboard/assets/images/logo-colors.png';

});


function SignInPassword() {
    var username = document.getElementById('username').value;
    var password = document.getElementById('password').value;
    $.ajax({
        type: "POST",
        url: "/auth/sign-in/login",
        data: {
            username: username,
            password: password
        },
        headers: {
            "RequestVerificationToken": $('input[name="__RequestVerificationToken"]').val()
        },
        success: function (res) {
            if (res && res.message === 'success') {
                iziToast.success({ title: 'ورود با موفقیت انجام شد', message: 'شما به صفحه مدیریت هدایت میشوید', rtl: true, position: 'topCenter' });
                setTimeout(function () {
                    window.location.href = "/auth/verify-token";
                }, 3000);
            } else {
                iziToast.error({ title: 'خطا در ثبت اطلاعات', message: res.message, rtl: true, position: 'topCenter' });
            }
        },
        error: function (xhr, status, error) {
            iziToast.error({ title: 'خطا در ثبت اطلاعات', message: error, rtl: true, position: 'topCenter' });
        }
    })
}