Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewFerr committed Jul 30, 2024
1 parent 9c2ac46 commit f239242
Showing 1 changed file with 27 additions and 26 deletions.
53 changes: 27 additions & 26 deletions src/ClientWidgetApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -558,37 +558,38 @@ export class ClientWidgetApi extends EventEmitter {
});
}

private handleUpdateDelayedEvent(request: IUpdateDelayedEventFromWidgetActionRequest) {
if (!request.data.delay_id) {
return this.transport.reply<IWidgetApiErrorResponseData>(request, {
error: {message: "Invalid request - missing delay_id"},
});
}
private handleUpdateDelayedEvent(request: IUpdateDelayedEventFromWidgetActionRequest) {
if (!request.data.delay_id) {
return this.transport.reply<IWidgetApiErrorResponseData>(request, {
error: {message: "Invalid request - missing delay_id"},
});
}

if (!this.hasCapability(MatrixCapabilities.MSC4157UpdateDelayedEvent)) {
return this.transport.reply<IWidgetApiErrorResponseData>(request, {
error: {message: "Missing capability"},
});
}
if (!this.hasCapability(MatrixCapabilities.MSC4157UpdateDelayedEvent)) {
return this.transport.reply<IWidgetApiErrorResponseData>(request, {
error: {message: "Missing capability"},
});
}

switch (request.data.action) {
case UpdateDelayedEventAction.Cancel:
case UpdateDelayedEventAction.Restart:
case UpdateDelayedEventAction.Send:
this.driver.updateDelayedEvent(request.data.delay_id, request.data.action).then(() => {
return this.transport.reply<IWidgetApiAcknowledgeResponseData>(request, {});
}).catch(e => {
console.error("error updating delayed event: ", e);
switch (request.data.action) {
case UpdateDelayedEventAction.Cancel:
case UpdateDelayedEventAction.Restart:
case UpdateDelayedEventAction.Send:
this.driver.updateDelayedEvent(request.data.delay_id, request.data.action).then(() => {
return this.transport.reply<IWidgetApiAcknowledgeResponseData>(request, {});
}).catch(e => {
console.error("error updating delayed event: ", e);
return this.transport.reply<IWidgetApiErrorResponseData>(request, {
error: {message: "Error updating delayed event"},
});
});
break;
default:
return this.transport.reply<IWidgetApiErrorResponseData>(request, {
error: {message: "Error updating delayed event"},
error: {message: "Invalid request - unsupported action"},
});
});
default:
return this.transport.reply<IWidgetApiErrorResponseData>(request, {
error: {message: "Invalid request - unsupported action"},
});
}
}
}

private async handleSendToDevice(request: ISendToDeviceFromWidgetActionRequest): Promise<void> {
if (!request.data.type) {
Expand Down

0 comments on commit f239242

Please sign in to comment.