mirror of
https://github.com/frappe/books.git
synced 2024-11-10 07:40:55 +00:00
Add signup
This commit is contained in:
parent
c04123a2d1
commit
695f02eb49
21
index.js
21
index.js
@ -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() {
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user