2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 07:40:55 +00:00

Add signup

This commit is contained in:
Faris Ansari 2018-05-07 09:53:20 +05:30
parent c04123a2d1
commit 695f02eb49
2 changed files with 26 additions and 3 deletions

View File

@ -218,10 +218,27 @@ module.exports = {
token: res.token
}
return;
return res;
}
return await response.text();
return response;
},
async signup(email, fullName, password) {
let response = await fetch(this.getServerURL() + '/api/signup', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({ email, fullName, password })
});
if (response.status === 200) {
return await response.json();
}
return response;
},
getServerURL() {

View File

@ -111,9 +111,15 @@ module.exports = class BaseDocument extends Observable {
// set standard values on server-side only
if (frappe.isServer) {
let now = (new Date()).toISOString();
if (!this.submitted) this.submitted = 0;
if (!this.submitted) {
this.submitted = 0;
}
if (!this.owner) {
this.owner = frappe.session.user;
}
if (!this.creation) {
this.creation = now;
}