Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
} else {
if (options && options.onSuccess) {
const ret = options.onSuccess(json);
if (ret && ret.then) {
yield ret;
}
}
self.markSaving(false);
self.updateMessage(json.msg || (options && options.successMessage));
self.msg &&
(getRoot(self) as IRendererStore).notify('success', self.msg);
return json.data;
}
} catch (e) {
if ((getRoot(self) as IRendererStore).storeType !== 'RendererStore') {
// 已经销毁了,不管这些数据了。
return;
}
self.markSaving(false);
// console.error(e.stack);`
(getRoot(self) as IRendererStore).notify('error', e.message);
throw e;
}
});
updateAnnotation (value) {
const { addAnnotation } = getRoot(self).classifications
addAnnotation(self, value)
},
installNodeModules: flow(function*() {
const store = getRoot(self);
yield self.runScript('install');
store.createNotification('Done', `Dependencies for ${self.name} are installed.`);
}),
reinstallDependencies: flow(function*() {
get completion() {
return getRoot(self).completionStore.selected;
},
}));
const validUPPReference = isValidReference(() => getRoot(self).userProjectPreferences.active)
const validWorkflowReference = isValidReference(() => self.active)
afterCreate() {
const selfRoot = getRoot(self)
targetStore = getEnv(self).targetStore || selfRoot
if (targetStore === self) {
throw new Error(
"UndoManager should be created as part of a tree, or with `targetStore` in it's environment"
)
}
addDisposer(self, addMiddleware(targetStore, undoRedoMiddleware, false))
},
undo: decorate(atomic, () => {
fetch: flow(function * fetch () {
const { client, project, user } = getRoot(self)
self.loadingState = asyncStates.loading
try {
const token = yield auth.checkBearerToken()
const authorization = `Bearer ${token}`
const query = {
project_id: project.id,
sort: '-created_at'
}
const response = yield client.panoptes.get(`/users/${user.id}/recents`, query, { authorization })
const { recents } = response.body
self.recents = recents.map(recent => ({
subjectId: recent.links.subject,
locations: recent.locations
}))
self.loadingState = asyncStates.success
} catch (error) {
getAssignee() {
if (!this.assignee) return undefined;
return getRoot(self).users.get(this.assignee);
},
}))