From eb0c83c73350c7b97a60be0e63faea0bb11f54cf Mon Sep 17 00:00:00 2001 From: AkiraFukushima Date: Sat, 10 Mar 2018 23:28:55 +0900 Subject: [PATCH] refs #7 Add loading in login button --- src/main/index.js | 1 + src/renderer/components/Login/InstanceForm.vue | 1 + src/renderer/components/Login/LoginForm.vue | 14 ++++++++++++++ 3 files changed, 16 insertions(+) diff --git a/src/main/index.js b/src/main/index.js index acbc5f8d..a5a8fcdc 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -68,6 +68,7 @@ ipcMain.on('get-auth-url', (event, domain) => { .then((url) => { console.log(url) event.sender.send('response-get-auth-url', url) + // Open authorize url in default browser. shell.openExternal(url) }) }) diff --git a/src/renderer/components/Login/InstanceForm.vue b/src/renderer/components/Login/InstanceForm.vue index 38bf6ba8..48a23a96 100644 --- a/src/renderer/components/Login/InstanceForm.vue +++ b/src/renderer/components/Login/InstanceForm.vue @@ -35,6 +35,7 @@ export default { this.$store.commit('Login/changePage', 2) }) .catch(() => { + loading.close() this.$message({ message: 'Could not search instance', type: 'error' diff --git a/src/renderer/components/Login/LoginForm.vue b/src/renderer/components/Login/LoginForm.vue index c0e6155e..395afe2b 100644 --- a/src/renderer/components/Login/LoginForm.vue +++ b/src/renderer/components/Login/LoginForm.vue @@ -35,10 +35,24 @@ export default { }, methods: { login () { + const loading = this.$loading({ + lock: true, + text: 'Loading', + spinner: 'el-icon-loading', + background: 'rgba(0, 0, 0, 0.7)' + }) this.$store.dispatch('Login/fetchLogin', this.selectedInstance) .then((url) => { + loading.close() this.$router.push({ path: '/authorize' }) }) + .catch(() => { + loading.close() + this.$message({ + message: 'Could not get authorize url', + type: 'error' + }) + }) }, changeInstance (value) { this.$store.dispatch('Login/changeInstance', value)