Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_updateServerState(state) {
let appStore = getParent(self, 3);
let url = "/api/tasks/" + appStore.task.id + "/completions/" + self.pk + "/";
getEnv(self).patch(url, JSON.stringify(state));
},
get client () {
return getEnv(self).client
}
}))
const list = flow(function*(term?: string, id?: string) {
const request = new DTOs.ListCatalogBrands();
request.term = term;
request.id = id;
self.loading = true;
try {
const client = getEnv(self).api as ApiClientType;
const results: DTOs.PagedResponse = yield client.paged(request);
results.records.forEach(record => {
self.entries.put(record);
});
} catch (error) {
debug('received http error: ', error);
}
self.loading = false;
});
const add = (brand: BrandType) => {
get alert() {
return getEnv(self).alert
},
get isLoading() {
addGroup: flow(function* load(groupId: string) {
const backendSrv = getEnv(self).backendSrv;
yield backendSrv.post(`/api/teams/${self.id}/groups`, { groupId: groupId });
self.groups.set(
groupId,
TeamGroup.create({
teamId: self.id,
groupId: groupId,
})
);
}),
const requestByState = new DTOs.OrderingSalesByState();
if (self.period && self.period.from) {
requestChart.from = self.period.from;
requestWeekOverWeek.from = self.period.from;
requestByState.from = self.period.from;
}
if (self.period && self.period.to) {
requestChart.to = self.period.to;
requestWeekOverWeek.to = self.period.to;
requestByState.to = self.period.to;
}
self.loading = true;
try {
const client = getEnv(self).api as ApiClientType;
const results: [DTOs.PagedResponse, DTOs.PagedResponse, DTOs.PagedResponse] =
yield Promise.all([
client.paged(requestChart),
client.paged(requestWeekOverWeek),
client.paged(requestByState)
]);
self.chart.replace(results[0].records.map(x => [x.id, x]));
self.weekOverWeek.replace(results[1].records.map(x => [x.id, x]));
self.byState.replace(results[2].records.map(x => [x.id, x]));
} catch (error) {
debug('received http error: ', error);
throw error;
}
self.loading = false;
deleteRegion(region) {
const arr = self.regions;
for (let i = 0; i < arr.length; i++) {
if (arr[i] === region) {
arr.splice(i, 1);
}
}
getEnv(self).onEntityDelete(region);
},
const submit = flow(function*() {
const request = new DTOs.AddCatalogType();
request.typeId = self.id;
request.type = self.type;
try {
const client = getEnv(self).api as ApiClientType;
const result: DTOs.CommandResponse = yield client.command(request);
} catch (error) {
debug('received http error: ', error);
throw error;
}
});
const submit = flow(function*() {
const request = new DTOs.AddCatalogBrand();
request.brandId = self.id;
request.brand = self.brand;
try {
const client = getEnv(self).api as ApiClientType;
const result: DTOs.CommandResponse = yield client.command(request);
} catch (error) {
debug('received http error: ', error);
throw error;
}
});
renderNoCompletion() {
return ;
}