async function anonymous(__self,scope ) { with (scope) { __self.result = { email: '', username: '', old_password: '', password: '', password_confirmation: '', remember: true, loading: { loading: false, register: false, forget: false, changePassword: false, }, errors: { login: {}, register: {}, forget: {}, changePassword: {}, }, success: { forget: false, changePassword: false, }, login() { window.axios.post('https://missav.ws/en/api/login', { email: this.email, password: this.password, remember: this.remember, }).then(response => { this.handleUserResponse(response) }).catch(error => { this.handleErrorResponse('login', error) }).then(() => { this.loading.login = false }) this.loading.login = true this.errors.login = {} }, register() { this.requireRecaptcha(recaptchaToken => { window.axios.post('https://missav.ws/en/api/register', { email: this.email, username: this.username, password: this.password, password_confirmation: this.password_confirmation, recaptcha_token: recaptchaToken, }).then(response => { this.handleUserResponse(response) }).catch(error => { this.handleErrorResponse('register', error) }).then(() => { this.loading.register = false }) }) this.loading.register = true this.errors.register = {} }, forget() { this.requireRecaptcha(recaptchaToken => { window.axios.post('https://missav.ws/en/api/forget', { email: this.email, recaptcha_token: recaptchaToken, }).then(response => { this.success.forget = true }).catch(error => { this.handleErrorResponse('forget', error) }).then(() => { this.loading.forget = false }) }) this.loading.forget = true this.errors.forget = {} }, changePassword() { this.requireRecaptcha(recaptchaToken => { window.axios.post('https://missav.ws/api/password/update', { old_password: this.old_password, password: this.password, password_confirmation: this.password_confirmation, recaptcha_token: recaptchaToken, }).then(response => { this.success.changePassword = true }).catch(error => { this.handleErrorResponse('changePassword', error) }).then(() => { this.loading.changePassword = false }) }) this.loading.changePassword = true this.errors.changePassword = {} }, handleUserResponse(response) { this.user = response.data.user this.showModal.login = false if (this.loginCallback) { this.loginCallback() } }, } }; __self.finished = true; return __self.result; }