Skip to content

Commit

Permalink
refactor: remove null and set undefined as fallback for params in emi…
Browse files Browse the repository at this point in the history
…tAndWait

Signed-off-by: Stefan Dej <[email protected]>
  • Loading branch information
meteyou committed Nov 5, 2024
1 parent 2eb5c4b commit d6e18cc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/plugins/webSocketClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export class WebSocketClient {
)
}

async emitAndWait(method: string, params: Params | null, options: emitOptions = {}): Promise<any> {
async emitAndWait(method: string, params: Params | undefined = undefined, options: emitOptions = {}): Promise<any> {
return new Promise((resolve, reject) => {
if (this.instance?.readyState !== WebSocket.OPEN) reject()

Expand All @@ -200,7 +200,7 @@ export class WebSocketClient {
JSON.stringify({
jsonrpc: '2.0',
method,
params: params ?? undefined,
params,
id,
})
)
Expand Down
2 changes: 1 addition & 1 deletion src/store/printer/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const actions: ActionTree<PrinterState, RootState> = {
},

async initSubscripts({ dispatch }) {
const payload = await Vue.$socket.emitAndWait('printer.objects.list', null, {})
const payload = await Vue.$socket.emitAndWait('printer.objects.list')

let subscripts = {}
const blocklist = ['menu']
Expand Down

0 comments on commit d6e18cc

Please sign in to comment.