diff --git a/src/store/server/actions.ts b/src/store/server/actions.ts index 7ab37b19..859cbace 100644 --- a/src/store/server/actions.ts +++ b/src/store/server/actions.ts @@ -23,24 +23,13 @@ export const actions: ActionTree = { try { let token = localStorage.getItem('token') - let data = { + const connection = await Vue.$socket.emitAndWait('server.connection.identify', { client_name: 'mainsail', version: rootState.packageVersion, type: 'web', url: 'https://github.com/mainsail-crew/mainsail', - } - - let dataWithToken = { - client_name: 'mainsail', - version: rootState.packageVersion, - type: 'web', - url: 'https://github.com/mainsail-crew/mainsail', - access_token: token - } - - let wsData = token ? dataWithToken : data; - - const connection = await Vue.$socket.emitAndWait('server.connection.identify', wsData) + ...(token ? { access_token: token }: {}) + }) commit('setConnectionId', connection.connection_id) } catch (e: any) { if (e.message === 'Unauthorized') {