You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-08 21:42:24 +03:00
Handle M_NOT_FOUND
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user