summaryrefslogtreecommitdiffstats
path: root/apps/twofactor_backupcodes/src/service
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2018-09-25 10:49:56 +0200
committerChristoph Wurst <christoph@winzerhof-wurst.at>2018-09-27 09:07:05 +0200
commitedc861b0414cbaa0ded51994ee7f24db2ef48689 (patch)
tree64026661573c344481903a85d4655230cedfd291 /apps/twofactor_backupcodes/src/service
parent7882be160a858a2958abb7657c0db86d08ff3981 (diff)
downloadnextcloud-server-edc861b0414cbaa0ded51994ee7f24db2ef48689.tar.gz
nextcloud-server-edc861b0414cbaa0ded51994ee7f24db2ef48689.zip
Move to standard format
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/twofactor_backupcodes/src/service')
-rw-r--r--apps/twofactor_backupcodes/src/service/BackupCodesService.js21
-rw-r--r--apps/twofactor_backupcodes/src/service/PrintService.js7
2 files changed, 28 insertions, 0 deletions
diff --git a/apps/twofactor_backupcodes/src/service/BackupCodesService.js b/apps/twofactor_backupcodes/src/service/BackupCodesService.js
new file mode 100644
index 00000000000..c7259e826a1
--- /dev/null
+++ b/apps/twofactor_backupcodes/src/service/BackupCodesService.js
@@ -0,0 +1,21 @@
+import axio from 'axios';
+
+export function getState () {
+ const url = OC.generateUrl('/apps/twofactor_backupcodes/settings/state');
+
+ return axio.get(url, {
+ headers: {
+ requesttoken: OC.requestToken
+ }
+ }).then(resp => resp.data);
+}
+
+export function generateCodes () {
+ const url = OC.generateUrl('/apps/twofactor_backupcodes/settings/create');
+
+ return axio.post(url, {}, {
+ headers: {
+ requesttoken: OC.requestToken
+ }
+ }).then(resp => resp.data)
+}
diff --git a/apps/twofactor_backupcodes/src/service/PrintService.js b/apps/twofactor_backupcodes/src/service/PrintService.js
new file mode 100644
index 00000000000..a01150de7d7
--- /dev/null
+++ b/apps/twofactor_backupcodes/src/service/PrintService.js
@@ -0,0 +1,7 @@
+export function print (data) {
+ const newTab = window.open('', t('twofactor_backupcodes', 'Nextcloud backup codes'));
+ newTab.document.write('<h1>' + t('twofactor_backupcodes', 'Nextcloud backup codes') + '</h1>');
+ newTab.document.write(data);
+ newTab.print();
+ newTab.close();
+}