diff options
author | 2017-12-04 16:46:42 +0100 | |
---|---|---|
committer | 2017-12-04 16:46:42 +0100 | |
commit | 1f3df7365bdbe34d1998adc30281a16b5a7b5e31 (patch) | |
tree | 1a77ff4b67c52453a5a8e7ab67799dd088f94242 /src/api | |
parent | fix(Shortcuts): Fix service shortcuts for disabled but shown services (@joses... (diff) | |
download | ferdium-app-1f3df7365bdbe34d1998adc30281a16b5a7b5e31.tar.gz ferdium-app-1f3df7365bdbe34d1998adc30281a16b5a7b5e31.tar.zst ferdium-app-1f3df7365bdbe34d1998adc30281a16b5a7b5e31.zip |
feat(Account): Enable a user to delete their own account
Diffstat (limited to 'src/api')
-rw-r--r-- | src/api/UserApi.js | 4 | ||||
-rw-r--r-- | src/api/server/ServerApi.js | 13 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/api/UserApi.js b/src/api/UserApi.js index e8fd75bed..edfb88988 100644 --- a/src/api/UserApi.js +++ b/src/api/UserApi.js | |||
@@ -46,4 +46,8 @@ export default class UserApi { | |||
46 | getLegacyServices() { | 46 | getLegacyServices() { |
47 | return this.server.getLegacyServices(); | 47 | return this.server.getLegacyServices(); |
48 | } | 48 | } |
49 | |||
50 | delete() { | ||
51 | return this.server.deleteAccount(); | ||
52 | } | ||
49 | } | 53 | } |
diff --git a/src/api/server/ServerApi.js b/src/api/server/ServerApi.js index f25f02eaa..644bf20cd 100644 --- a/src/api/server/ServerApi.js +++ b/src/api/server/ServerApi.js | |||
@@ -125,6 +125,19 @@ export default class ServerApi { | |||
125 | return user; | 125 | return user; |
126 | } | 126 | } |
127 | 127 | ||
128 | async deleteAccount() { | ||
129 | const request = await window.fetch(`${SERVER_URL}/${API_VERSION}/me`, this._prepareAuthRequest({ | ||
130 | method: 'DELETE', | ||
131 | })); | ||
132 | if (!request.ok) { | ||
133 | throw request; | ||
134 | } | ||
135 | const data = await request.json(); | ||
136 | |||
137 | console.debug('ServerApi::deleteAccount resolves', data); | ||
138 | return data; | ||
139 | } | ||
140 | |||
128 | // Services | 141 | // Services |
129 | async getServices() { | 142 | async getServices() { |
130 | const request = await window.fetch(`${SERVER_URL}/${API_VERSION}/me/services`, this._prepareAuthRequest({ | 143 | const request = await window.fetch(`${SERVER_URL}/${API_VERSION}/me/services`, this._prepareAuthRequest({ |