mirror of
https://github.com/element-hq/element-web.git
synced 2024-12-03 20:36:57 +03:00
Handle M_NOT_FOUND
This commit is contained in:
parent
b70881f078
commit
34d7d793b7
1 changed files with 12 additions and 0 deletions
|
@ -315,6 +315,18 @@ function setWidget(event, roomId) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return client.sendStateEvent(roomId, "im.vector.modular.widgets", widgets);
|
return client.sendStateEvent(roomId, "im.vector.modular.widgets", widgets);
|
||||||
|
}, (err) => {
|
||||||
|
if (err.errcode === "M_NOT_FOUND") {
|
||||||
|
return client.sendStateEvent(roomId, "im.vector.modular.widgets", {
|
||||||
|
[widgetId]: {
|
||||||
|
type: widgetType,
|
||||||
|
url: widgetUrl,
|
||||||
|
name: widgetName,
|
||||||
|
data: widgetData,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
throw err;
|
||||||
}).done(() => {
|
}).done(() => {
|
||||||
sendResponse(event, {
|
sendResponse(event, {
|
||||||
success: true,
|
success: true,
|
||||||
|
|
Loading…
Reference in a new issue