make that login & register work
This commit is contained in:
@@ -2,15 +2,27 @@
|
||||
|
||||
@push('js')
|
||||
<script>
|
||||
async function login(event) {
|
||||
const response = await postData(event.target.action, getFormData(event))
|
||||
|
||||
async function login(event) {
|
||||
const response = await postData(event.target.action, getFormData(event))
|
||||
|
||||
if (response.errors) {
|
||||
loopObject(response.errors, item => addValidationClasses(item))
|
||||
} else {
|
||||
removeValidationClasess()
|
||||
}
|
||||
loopObject(response.errors, item => addValidationClasses(item))
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
removeValidationClasess()
|
||||
|
||||
await Swal.fire({
|
||||
title: '{{ __('Successfully logged in') }}',
|
||||
text: '{{ __('Please wait while we redirect you to your personal account') }}',
|
||||
icon: 'success',
|
||||
showDenyButton: false,
|
||||
showCancelButton: false,
|
||||
})
|
||||
|
||||
window.location.href = '{{ route('login') }}'
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
|
||||
@@ -2,16 +2,27 @@
|
||||
|
||||
@push('js')
|
||||
<script>
|
||||
async function register(event) {
|
||||
const response = await postData(event.target.action, getFormData(event))
|
||||
console.log(response)
|
||||
|
||||
async function register(event) {
|
||||
const response = await postData(event.target.action, getFormData(event))
|
||||
|
||||
if (response.errors) {
|
||||
loopObject(response.errors, item => addValidationClasses(item))
|
||||
} else {
|
||||
removeValidationClasess()
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
removeValidationClasess()
|
||||
|
||||
await Swal.fire({
|
||||
title: '{{ __('Successfully logged in') }}',
|
||||
text: '{{ __('Please wait while we redirect you to your personal account') }}',
|
||||
icon: 'success',
|
||||
showDenyButton: false,
|
||||
showCancelButton: false,
|
||||
})
|
||||
|
||||
window.location.href = '{{ route('login') }}'
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
|
||||
Reference in New Issue
Block a user