custom kick message, fixes #56.

This commit is contained in:
Miroslav Šedivý 2021-07-17 19:37:50 +02:00
parent b9b80ed79a
commit 122fd8b957
7 changed files with 16 additions and 4 deletions

View File

@ -72,6 +72,7 @@ export const connection = {
reconnecting: 'Reconnecting...', reconnecting: 'Reconnecting...',
connected: 'Connected', connected: 'Connected',
disconnected: 'Disconnected', disconnected: 'Disconnected',
kicked: 'You have been removed from this room.',
button_confirm: 'OK', button_confirm: 'OK',
} }

View File

@ -73,6 +73,8 @@ export const connection = {
//reconnecting: 'Reconnecting', //reconnecting: 'Reconnecting',
connected: 'Connectado correctamente', connected: 'Connectado correctamente',
disconnected: 'Has sido desconectado', disconnected: 'Has sido desconectado',
// TODO
//kicked: 'You have been removed from this room.',
button_confirm: 'De acuerdo', button_confirm: 'De acuerdo',
} }

View File

@ -73,6 +73,8 @@ export const connection = {
//reconnecting: 'Reconnecting', //reconnecting: 'Reconnecting',
connected: 'Connecté', connected: 'Connecté',
disconnected: 'Déconnecté', disconnected: 'Déconnecté',
// TODO
//kicked: 'You have been removed from this room.',
button_confirm: 'OK', button_confirm: 'OK',
} }

View File

@ -73,6 +73,8 @@ export const connection = {
//reconnecting: 'Reconnecting', //reconnecting: 'Reconnecting',
connected: 'Tilkoblet', connected: 'Tilkoblet',
disconnected: 'Frakoblet', disconnected: 'Frakoblet',
// TODO
//kicked: 'You have been removed from this room.',
button_confirm: 'OK', button_confirm: 'OK',
} }

View File

@ -72,6 +72,7 @@ export const connection = {
reconnecting: 'Obnova spojenia...', reconnecting: 'Obnova spojenia...',
connected: 'Úspešne pripojený/á', connected: 'Úspešne pripojený/á',
disconnected: 'Boli ste odpojený/á', disconnected: 'Boli ste odpojený/á',
kicked: 'Boli ste odstránený/á z tejto miestnosti.',
button_confirm: 'Ok', button_confirm: 'Ok',
} }

View File

@ -73,6 +73,8 @@ export const connection = {
//reconnecting: 'Reconnecting', //reconnecting: 'Reconnecting',
connected: 'Du har loggats in', connected: 'Du har loggats in',
disconnected: 'Du har blivit frånkopplad', disconnected: 'Du har blivit frånkopplad',
// TODO
//kicked: 'You have been removed from this room.',
button_confirm: 'Ok', button_confirm: 'Ok',
} }

View File

@ -105,10 +105,6 @@ export class NekoClient extends BaseClient implements EventEmitter<NekoEvents> {
protected [EVENT.DISCONNECTED](reason?: Error) { protected [EVENT.DISCONNECTED](reason?: Error) {
this.cleanup() this.cleanup()
if (reason && reason.message == 'kicked') {
this.$accessor.logout()
}
this.$vue.$notify({ this.$vue.$notify({
group: 'neko', group: 'neko',
type: 'error', type: 'error',
@ -135,7 +131,13 @@ export class NekoClient extends BaseClient implements EventEmitter<NekoEvents> {
// System Events // System Events
///////////////////////////// /////////////////////////////
protected [EVENT.SYSTEM.DISCONNECT]({ message }: DisconnectPayload) { protected [EVENT.SYSTEM.DISCONNECT]({ message }: DisconnectPayload) {
if (message == 'kicked') {
this.$accessor.logout()
message = this.$vue.$t('connection.kicked') as string
}
this.onDisconnected(new Error(message)) this.onDisconnected(new Error(message))
this.$vue.$swal({ this.$vue.$swal({
title: this.$vue.$t('connection.disconnected'), title: this.$vue.$t('connection.disconnected'),
text: message, text: message,