diff options
author | 2019-07-04 15:54:27 +0200 | |
---|---|---|
committer | 2019-07-04 15:54:27 +0200 | |
commit | 268db27162e8d2cd0252b1be9bf69006cf6323ca (patch) | |
tree | 6ca47ee4159ba79f88d8848ac2ba9a8a8a7700da /src/api | |
parent | Merge branch 'release/5.2.0-beta.4' into feature/new-pricing (diff) | |
download | ferdium-app-268db27162e8d2cd0252b1be9bf69006cf6323ca.tar.gz ferdium-app-268db27162e8d2cd0252b1be9bf69006cf6323ca.tar.zst ferdium-app-268db27162e8d2cd0252b1be9bf69006cf6323ca.zip |
Add trial onboarding during signup
Diffstat (limited to 'src/api')
-rw-r--r-- | src/api/UserApi.js | 4 | ||||
-rw-r--r-- | src/api/server/ServerApi.js | 18 |
2 files changed, 21 insertions, 1 deletions
diff --git a/src/api/UserApi.js b/src/api/UserApi.js index edfb88988..8ba8cd1e9 100644 --- a/src/api/UserApi.js +++ b/src/api/UserApi.js | |||
@@ -25,6 +25,10 @@ export default class UserApi { | |||
25 | return this.server.retrievePassword(email); | 25 | return this.server.retrievePassword(email); |
26 | } | 26 | } |
27 | 27 | ||
28 | activateTrial(data) { | ||
29 | return this.server.activateTrial(data); | ||
30 | } | ||
31 | |||
28 | invite(data) { | 32 | invite(data) { |
29 | return this.server.inviteUser(data); | 33 | return this.server.inviteUser(data); |
30 | } | 34 | } |
diff --git a/src/api/server/ServerApi.js b/src/api/server/ServerApi.js index a9ce202ff..f2568d597 100644 --- a/src/api/server/ServerApi.js +++ b/src/api/server/ServerApi.js | |||
@@ -77,6 +77,22 @@ export default class ServerApi { | |||
77 | return u.token; | 77 | return u.token; |
78 | } | 78 | } |
79 | 79 | ||
80 | async activateTrial(data) { | ||
81 | const request = await sendAuthRequest(`${API_URL}/payment/trial`, { | ||
82 | method: 'POST', | ||
83 | body: JSON.stringify(data), | ||
84 | }); | ||
85 | if (!request.ok) { | ||
86 | throw request; | ||
87 | } | ||
88 | const trial = await request.json(); | ||
89 | |||
90 | console.log(trial); | ||
91 | |||
92 | debug('ServerApi::signup resolves', trial); | ||
93 | return true; | ||
94 | } | ||
95 | |||
80 | async inviteUser(data) { | 96 | async inviteUser(data) { |
81 | const request = await sendAuthRequest(`${API_URL}/invite`, { | 97 | const request = await sendAuthRequest(`${API_URL}/invite`, { |
82 | method: 'POST', | 98 | method: 'POST', |
@@ -469,7 +485,7 @@ export default class ServerApi { | |||
469 | return services; | 485 | return services; |
470 | } | 486 | } |
471 | } catch (err) { | 487 | } catch (err) { |
472 | throw (new Error('ServerApi::getLegacyServices no config found')); | 488 | console.error('ServerApi::getLegacyServices no config found'); |
473 | } | 489 | } |
474 | 490 | ||
475 | return []; | 491 | return []; |