1
0
mirror of https://github.com/h3poteto/whalebird-desktop synced 2024-12-23 23:47:57 +01:00

Merge pull request #19 from h3poteto/iss-7

refs #7 Add loading in login button
This commit is contained in:
AkiraFukushima 2018-03-10 23:29:37 +09:00 committed by GitHub
commit 89b1e8898d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 0 deletions

View File

@ -68,6 +68,7 @@ ipcMain.on('get-auth-url', (event, domain) => {
.then((url) => { .then((url) => {
console.log(url) console.log(url)
event.sender.send('response-get-auth-url', url) event.sender.send('response-get-auth-url', url)
// Open authorize url in default browser.
shell.openExternal(url) shell.openExternal(url)
}) })
}) })

View File

@ -35,6 +35,7 @@ export default {
this.$store.commit('Login/changePage', 2) this.$store.commit('Login/changePage', 2)
}) })
.catch(() => { .catch(() => {
loading.close()
this.$message({ this.$message({
message: 'Could not search instance', message: 'Could not search instance',
type: 'error' type: 'error'

View File

@ -35,10 +35,24 @@ export default {
}, },
methods: { methods: {
login () { 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) this.$store.dispatch('Login/fetchLogin', this.selectedInstance)
.then((url) => { .then((url) => {
loading.close()
this.$router.push({ path: '/authorize' }) this.$router.push({ path: '/authorize' })
}) })
.catch(() => {
loading.close()
this.$message({
message: 'Could not get authorize url',
type: 'error'
})
})
}, },
changeInstance (value) { changeInstance (value) {
this.$store.dispatch('Login/changeInstance', value) this.$store.dispatch('Login/changeInstance', value)