const sendApiRequest=async t=>{let o=t.error;try{await $.ajax({...t,error:t=>{403==t.status?window.location.reload():500==t.status?Toastify({text:"Failed! Something went wrong.",duration:3e3,close:!0,gravity:"top",position:"right",stopOnFocus:!0,className:"bg-danger"}).showToast():400!=t.status||"invalid csrf token"!=t.responseText&&"invalid captcha"!=t.responseText?"function"==typeof o?o(t):Toastify({text:"Failed! Something went wrong.",duration:3e3,close:!0,gravity:"top",position:"right",stopOnFocus:!0,className:"bg-danger"}).showToast():(localStorage.setItem("invalid_csrf_token",1),window.location.reload())}})}catch(t){}};$(document).ready(()=>{1==localStorage.getItem("login_success")&&(Toastify({text:"Login success!",duration:3e3,close:!0,gravity:"top",position:"right",stopOnFocus:!0,className:"bg-success"}).showToast(),localStorage.removeItem("login_success")),1==localStorage.getItem("request_error")&&(Toastify({text:"Failed! Something went wrong.",duration:3e3,close:!0,gravity:"top",position:"right",stopOnFocus:!0,className:"bg-danger"}).showToast(),localStorage.removeItem("request_error")),1==localStorage.getItem("invalid_csrf_token")&&(Toastify({text:"Invalid CSRF token!",duration:3e3,close:!0,gravity:"top",position:"right",stopOnFocus:!0,className:"bg-warning"}).showToast(),localStorage.removeItem("invalid_csrf_token"))});