mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
add autoconnect prop.
This commit is contained in:
parent
9d4740f7e5
commit
31cfacd1df
@ -86,14 +86,17 @@
|
|||||||
height: 0,
|
height: 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Prop({ type: Boolean })
|
@Prop({ type: String })
|
||||||
private readonly autoplay!: boolean
|
private readonly server!: string
|
||||||
|
|
||||||
@Prop({ type: Boolean })
|
@Prop({ type: Boolean })
|
||||||
private readonly autologin!: boolean
|
private readonly autologin!: boolean
|
||||||
|
|
||||||
@Prop({ type: String })
|
@Prop({ type: Boolean })
|
||||||
private readonly server!: string
|
private readonly autoconnect!: boolean
|
||||||
|
|
||||||
|
@Prop({ type: Boolean })
|
||||||
|
private readonly autoplay!: boolean
|
||||||
|
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
// Public state
|
// Public state
|
||||||
@ -171,7 +174,7 @@
|
|||||||
// Public methods
|
// Public methods
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
@Watch('server', { immediate: true })
|
@Watch('server', { immediate: true })
|
||||||
public setUrl(url: string) {
|
public async setUrl(url: string) {
|
||||||
if (!url) {
|
if (!url) {
|
||||||
url = location.href
|
url = location.href
|
||||||
}
|
}
|
||||||
@ -200,10 +203,12 @@
|
|||||||
this.websocket.setToken(token)
|
this.websocket.setToken(token)
|
||||||
}
|
}
|
||||||
|
|
||||||
this.api.session.whoami().then(() => {
|
await this.api.session.whoami()
|
||||||
Vue.set(this.state.connection, 'authenticated', true)
|
Vue.set(this.state.connection, 'authenticated', true)
|
||||||
|
|
||||||
|
if (this.autoconnect) {
|
||||||
this.websocket.connect()
|
this.websocket.connect()
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,7 +228,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
Vue.set(this.state.connection, 'authenticated', true)
|
Vue.set(this.state.connection, 'authenticated', true)
|
||||||
this.websocket.connect()
|
|
||||||
|
if (this.autoconnect) {
|
||||||
|
this.websocket.connect()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async logout() {
|
public async logout() {
|
||||||
|
Loading…
Reference in New Issue
Block a user