diff --git a/src/views/components/AppLogin.js b/src/views/components/AppLogin.js new file mode 100644 index 0000000..bf700d5 --- /dev/null +++ b/src/views/components/AppLogin.js @@ -0,0 +1,72 @@ +export default { + name: 'AppLogin', + data() { + return { + login_link: '', + login_duration_sec: 0, + } + }, + methods: { + async openModal() { + try { + await this.submitApi(); + $('#modalLogin').modal({ + onApprove: function () { + return false; + } + }).modal('show'); + } catch (err) { + showErrorInfo(err) + } + }, + async submitApi() { + try { + let response = await http.get(`/app/login`) + let results = response.data.results; + this.login_link = results.qr_link; + this.login_duration_sec = results.qr_duration; + } catch (error) { + if (error.response) { + throw Error(error.response.data.message) + } + throw Error(error.message) + } + } + }, + template: ` +
+
+
Login
+
+ Scan your QRCode and you can use all this API feature +
+
+
+ + + + ` +} \ No newline at end of file diff --git a/src/views/index.html b/src/views/index.html index 5d129ca..75b6f02 100644 --- a/src/views/index.html +++ b/src/views/index.html @@ -41,14 +41,8 @@
-
-
-
Login
-
- Scan your QRCode and you can use all this API feature -
-
-
+ +
Logout
@@ -106,33 +100,6 @@
- - - -