Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async loadTemplateLibrary() {
const templateLibrary = new TemplateLibrary();
const templateIndex = await templateLibrary.getTemplateIndex({ latestVersion: true, ciceroVersion });
const templates = [];
for (const t in templateIndex) {
if (Object.prototype.hasOwnProperty.call(templateIndex, t)) {
templates.push({ key: t, value: `ap://${t}#hash`, text: t });
}
}
this.setState({ templates });
}
export function* pushTemplatesToStore() {
try {
const templateLibrary = new TemplateLibrary();
const templateIndex = yield templateLibrary
.getTemplateIndex({ latestVersion: false, ciceroVersion });
const templateIndexArray = Object.values(templateIndex);
yield put(actions.getTemplatesSuccess(templateIndexArray));
} catch (err) {
yield put(appActions.addAppError('Failed to load templates', err));
}
}
export function* pushTemplatesToStore() {
try {
const templateLibrary = new TemplateLibrary();
const templateIndex = yield templateLibrary
.getTemplateIndex({ latestVersion: true, ciceroVersion });
const templateIndexArray = Object.values(templateIndex);
yield put(actions.getTemplatesSuccess(templateIndexArray));
} catch (err) {
yield put(appActions.addAppError('Failed to load templates', err));
}
}