mirror of https://github.com/vector-im/riot-web
Handle M_NOT_FOUND
parent
b70881f078
commit
34d7d793b7
|
@ -315,6 +315,18 @@ function setWidget(event, roomId) {
|
|||
};
|
||||
}
|
||||
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(() => {
|
||||
sendResponse(event, {
|
||||
success: true,
|
||||
|
|
Loading…
Reference in New Issue