ui update, init to consumer statistics and manage pos user types

This commit is contained in:
2026-04-13 13:22:40 +03:30
parent d4dff4ebfd
commit af3123e61e
85 changed files with 1054 additions and 407 deletions
+15 -15
View File
@@ -1,7 +1,9 @@
import { EntityState, EntityStore } from '@/core/state';
import { defaultBaseStateData, EntityState, EntityStore } from '@/core/state';
import { HttpErrorResponse } from '@angular/common/http';
import { computed, inject, Injectable } from '@angular/core';
import { CookieService } from 'ngx-cookie-service';
import { finalize, map } from 'rxjs';
import { catchError, finalize, map } from 'rxjs';
import { COOKIE_KEYS } from 'src/assets/constants';
import { IPosInfoResponse } from './models/pos.io';
import { PosService } from './modules/landing/services/main.service';
@@ -17,12 +19,8 @@ export class PosStore extends EntityStore<IPosInfoResponse, PosState> {
constructor(private readonly cookieService: CookieService) {
super({
loading: false,
error: null,
entity: null,
initialized: false,
isRefreshing: false,
posId: cookieService.get('posId'),
...defaultBaseStateData,
posId: cookieService.get(COOKIE_KEYS.POS_ID),
});
}
@@ -35,9 +33,15 @@ export class PosStore extends EntityStore<IPosInfoResponse, PosState> {
this.patchState({ loading: false });
}),
catchError((err: HttpErrorResponse) => {
this.setError(err);
// if (err.status === 403) debugger;
throw err;
}),
map((entity: IPosInfoResponse) => {
if (entity) {
this.patchState({ entity: entity });
this.setEntity(entity);
}
return entity;
}),
@@ -46,12 +50,8 @@ export class PosStore extends EntityStore<IPosInfoResponse, PosState> {
override reset(): void {
this.setState({
loading: false,
error: null,
entity: null,
initialized: false,
isRefreshing: false,
posId: this.cookieService.get('posId'),
...defaultBaseStateData,
posId: this.cookieService.get(COOKIE_KEYS.POS_ID),
});
}
}