Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/twofactor_gateway.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2018-05-07 12:07:44 +0300
committerChristoph Wurst <christoph@winzerhof-wurst.at>2018-05-07 12:07:44 +0300
commit5ca03f2ab7d4747560f82102f27b1cf1fb9010a0 (patch)
treef0a7d72d879e9ea981e3db7cb948333283d5cdd2 /js
parenta23a7ea370af88bc51627f2a82ff9fe8ed837c73 (diff)
Update nextcloud_fetch lib
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'js')
-rw-r--r--js/service/registration.js25
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();