Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- loadUnits(index: number): Promise<number> {
- if (this.products[index].unitsLoaded) {
- //return Promise.resolve(index);
- }
- return this.requestUnits(this.products[index].id).then((res: b2b.UnitResponse[]) => {
- if (!this.products[index].units) {
- this.products[index].units = new Map<number, b2b.UnitMapElement>();
- }
- res.forEach(item => {
- if (!this.products[index].units.has(item.no)) {
- this.products[index].units.set(item.no, {
- auxiliaryUnit: item.unit
- });
- }
- });
- this.products[index].unitsLoaded = true;
- return index;
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment