|
|
@@ -53,9 +53,24 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
function getCookie(name) { |
|
|
|
var re = new RegExp(name + "=([^;]+)") |
|
|
|
var value = re.exec(document.cookie) |
|
|
|
|
|
|
|
return (value != null) ? unescape(value[1]) : null |
|
|
|
} |
|
|
|
|
|
|
|
function getToken() { |
|
|
|
return fetch("/sanctum/csrf-cookie", { |
|
|
|
method: 'GET' |
|
|
|
}).then( () => { |
|
|
|
this.token = this.getCookie('XSRF-TOKEN') |
|
|
|
return this.token |
|
|
|
}) |
|
|
|
} |
|
|
|
function register(event) { |
|
|
|
this.active = 'loading' |
|
|
|
fetch("/register", { |
|
|
|
this.getToken().then(() => {fetch("/register", { |
|
|
|
method: 'POST', |
|
|
|
headers: {'Content-Type': 'application/json', |
|
|
|
'Accept': 'application/json', |
|
|
@@ -81,6 +96,7 @@ |
|
|
|
/* console.log(response.json()) */ |
|
|
|
}); |
|
|
|
event.preventDefault(); |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
function checkPasswords() { |
|
|
@@ -122,6 +138,8 @@ |
|
|
|
return {active: 'register', token: '', errorMessage: ''} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
getToken, |
|
|
|
getCookie, |
|
|
|
register, |
|
|
|
checkPasswords, |
|
|
|
forgotPassword, |
|
|
|