ajax request login blade

This commit is contained in:
Resul Madesenow
2024-02-24 14:47:08 +05:00
parent 14cc231372
commit a6ad59c1f8
3 changed files with 87 additions and 52 deletions

View File

@@ -46,48 +46,14 @@
<script src="/assets/js/sweetalert2@11.js"></script>
<script src="/assets/js/fn.js"></script>
<script>
new Inputmask("+(\\9\\93)-99-99-99-99").mask(document.getElementById('phone'));
const phone = document.getElementById('phone');
async function resetPassword(event) {
const response = await postData(event.target.action, getFormData(event))
if (response.errors) {
loopObject(response.errors, item => addValidationClasses(item))
} else {
removeValidationClasess()
if (response.step === 1) {
showVerificationCodeBox()
Swal.fire({
title: '{{ __('Verification code') }}',
text: response.message,
icon: 'info'
})
}
if (response.step === 2) {
showPasswordBox()
Swal.fire({
title: '{{ __('Reset Password') }}',
text: response.message,
icon: 'warning'
})
}
if (response.step === 3) {
await Swal.fire({
title: response.message,
showDenyButton: false,
showCancelButton: false,
})
window.location.href = '{{ route('login') }}'
}
if (phone) {
new Inputmask("+(\\9\\93)-99-99-99-99").mask(document.getElementById('phone'));
}
}
</script>
@stack('js')
</body>
</html>