Skip to content

Commit

Permalink
fix(creator): handle non-existing votes attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitry-yudakov committed Oct 26, 2023
1 parent 9908b92 commit e4a507b
Showing 1 changed file with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -191,14 +191,18 @@ const ObjectStore = types
yield self.loadAsset2D(objectId);
yield Promise.all([self.fetchObjectOwner(), self.fetchObjectName(objectId)]);

self.votesAttr = ObjectUserAttribute.create({
objectId,
attributeName: AttributeNameEnum.VOTE,
pluginId: PluginIdEnum.CORE,
userId: getRootStore(self).sessionStore.userId
});
yield self.votesAttr.load();
yield self.votesAttr.countAllUsers();
try {
self.votesAttr = ObjectUserAttribute.create({
objectId,
attributeName: AttributeNameEnum.VOTE,
pluginId: PluginIdEnum.CORE,
userId: getRootStore(self).sessionStore.userId
});
yield self.votesAttr.load();
yield self.votesAttr.countAllUsers();
} catch (e) {
console.log(e);
}

self.commentsAttr = ObjectUserAttribute.create({
objectId,

0 comments on commit e4a507b

Please sign in to comment.