refactor user accounts structure

This commit is contained in:
2026-03-16 00:35:34 +03:30
parent 20be653499
commit 3c9f6eed1d
286 changed files with 2812 additions and 1133 deletions
-51
View File
@@ -11,7 +11,6 @@ import { LOCAL_STORAGE_KEYS } from '../../../assets/constants';
import {
IAuthAccountResponse,
IAuthResponse,
ISignupRequestPayload,
IUserLoginInfo,
LoginCredentials,
Maybe,
@@ -27,24 +26,6 @@ export class AuthService {
this.initializeAuth();
}
readonly modulesLoginRoutes = {
// ADMIN: ADMIN_API_ROUTES.login(),
// SCHOOL: SCHOOLS_API_ROUTES.login(),
// TEACHER: TEACHERS_API_ROUTES.login(),
} as Record<TRoles, string>;
readonly modulesSignupRoutes = {
// TEACHER: TEACHERS_API_ROUTES.signup(),
} as Record<TRoles, string>;
readonly modulesGetInfoRoutes = {
// SCHOOL: SCHOOLS_API_ROUTES.me(),
} as Record<TRoles, string>;
readonly modulesChangeInfoRoutes = {
// SCHOOL: SCHOOLS_API_ROUTES.editLoginInfo(),
} as Record<TRoles, string>;
private readonly http = inject(HttpClient);
private readonly router = inject(Router);
private captchaService = inject(CaptchaService);
@@ -113,35 +94,6 @@ export class AuthService {
);
}
signup(credentials: ISignupRequestPayload, role: TRoles): Observable<IAuthResponse> {
this.isLoading.set(true);
this.isLoadingSubject.next(true);
// const baseHeaders = this.captchaService.buildCaptchaHeaders({}, captcha);
return this.http
.post<IAuthResponse>(
this.modulesSignupRoutes[role],
credentials,
// {
// headers: baseHeaders,
// },
)
.pipe(
tap((response) => {
this.handleAuthSuccess(response);
return response;
}),
catchError((error) => {
console.error('Signup error:', error);
this.isLoadingSubject.next(false);
throw error;
}),
finalize(() => {
this.isLoading.set(false);
}),
);
}
logout(): void {
localStorage.removeItem(LOCAL_STORAGE_KEYS.AUTH_TOKEN);
localStorage.removeItem(LOCAL_STORAGE_KEYS.USER_DATA);
@@ -190,9 +142,6 @@ export class AuthService {
return throwError(() => new Error('متاسفانه مشکلی پیش آمده'));
}
changeInfo(credentials: IUserLoginInfo, role: TRoles): Observable<IAuthResponse> {
return this.http.post<IAuthResponse>(this.modulesChangeInfoRoutes[role], credentials);
}
// prepareUserInfoBasedOnRole(role: TRoles, info: ISchoolMeResponse): Partial<IUserLoginInfo> {
// if (role === 'SCHOOL') {