refactor: streamline state initialization across stores using defaultBaseStateData
- Replaced individual state properties (loading, error, entity, initialized, isRefreshing) with a spread of defaultBaseStateData in various entity stores including AccountStore, BusinessActivityStore, ConsumerComplexStore, PosStore, and others. - Updated imports to include defaultBaseStateData in relevant store files. - Enhanced consistency in state management across multiple stores. feat: add partner profile management components and services - Introduced PartnerProfileFormComponent and PartnerResetPasswordCardComponent for profile editing and password reset functionalities. - Created ProfileService to handle API interactions for partner profile management. - Added routes and constants for partner profile API and navigation. - Implemented UI components for displaying and editing partner profile information in single.component.html and single.component.ts.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { EntityState, EntityStore } from '@/core/state';
|
||||
import { defaultBaseStateData, EntityState, EntityStore } from '@/core/state';
|
||||
import { inject, Injectable } from '@angular/core';
|
||||
import { catchError, finalize } from 'rxjs';
|
||||
import { IPartnerResponse } from '../models';
|
||||
@@ -13,11 +13,7 @@ export class PartnerStore extends EntityStore<IPartnerResponse, PartnerState> {
|
||||
private readonly service = inject(PartnersService);
|
||||
constructor() {
|
||||
super({
|
||||
loading: false,
|
||||
error: null,
|
||||
entity: null,
|
||||
initialized: false,
|
||||
isRefreshing: false,
|
||||
...defaultBaseStateData,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { EntityState, EntityStore } from '@/core/state';
|
||||
import { defaultBaseStateData, EntityState, EntityStore } from '@/core/state';
|
||||
import { inject, Injectable } from '@angular/core';
|
||||
import { catchError, finalize } from 'rxjs';
|
||||
import { IUserResponse } from '../models';
|
||||
@@ -13,11 +13,7 @@ export class UserStore extends EntityStore<IUserResponse, UserState> {
|
||||
private readonly service = inject(UsersService);
|
||||
constructor() {
|
||||
super({
|
||||
loading: false,
|
||||
error: null,
|
||||
entity: null,
|
||||
initialized: false,
|
||||
isRefreshing: false,
|
||||
...defaultBaseStateData,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -38,14 +34,4 @@ export class UserStore extends EntityStore<IUserResponse, UserState> {
|
||||
this.patchState({ entity });
|
||||
});
|
||||
}
|
||||
|
||||
override reset(): void {
|
||||
this.setState({
|
||||
loading: false,
|
||||
error: null,
|
||||
entity: null,
|
||||
initialized: false,
|
||||
isRefreshing: false,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user