diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2018-05-07 12:07:44 +0300 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2018-05-07 12:07:44 +0300 |
commit | 5ca03f2ab7d4747560f82102f27b1cf1fb9010a0 (patch) | |
tree | f0a7d72d879e9ea981e3db7cb948333283d5cdd2 /js | |
parent | a23a7ea370af88bc51627f2a82ff9fe8ed837c73 (diff) |
Update nextcloud_fetch lib
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'js')
-rw-r--r-- | js/service/registration.js | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/js/service/registration.js b/js/service/registration.js index eee2dd4..a6aa230 100644 --- a/js/service/registration.js +++ b/js/service/registration.js @@ -1,15 +1,10 @@ import $ from 'jquery'; -import fetch from 'nextcloud_fetch'; +import { nc_fetch_json } from 'nextcloud_fetch'; export function getState() { let url = OC.generateUrl('/apps/twofactor_sms/settings/verification') - return fetch(url, { - headers: { - 'Accept': 'application/json', - 'Content-Type': 'application/json' - } - }).then(function (resp) { + return nc_fetch_json(url).then(function (resp) { if (resp.ok) { return resp.json(); } @@ -20,12 +15,8 @@ export function getState() { export function startVerification() { let url = OC.generateUrl('/apps/twofactor_sms/settings/verification/start') - return fetch(url, { - method: 'POST', - headers: { - 'Accept': 'application/json', - 'Content-Type': 'application/json' - } + return nc_fetch_json(url, { + method: 'POST' }).then(function (resp) { if (resp.ok) { return resp.json(); @@ -37,15 +28,11 @@ export function startVerification() { export function tryVerification(code) { let url = OC.generateUrl('/apps/twofactor_sms/settings/verification/finish') - return fetch(url, { + return nc_fetch_json(url, { method: 'POST', body: JSON.stringify({ verificationCode: code - }), - headers: { - 'Accept': 'application/json', - 'Content-Type': 'application/json' - } + }) }).then(function (resp) { if (resp.ok) { return resp.json(); |