init
This commit is contained in:
@@ -4,16 +4,13 @@ import { Component, EventEmitter, inject, Input, Output, signal } from '@angular
|
||||
import { Router } from '@angular/router';
|
||||
import images from 'src/assets/images';
|
||||
import { LoginComponent } from './login/login.component';
|
||||
import { ModifyLoginInfoComponent } from './modifyLoginInfo/modify-login-info.component';
|
||||
import { OTPComponent } from './otp/otp.component';
|
||||
import { SignupComponent } from './signup/signup.component';
|
||||
|
||||
type TSteps = 'login' | 'otp' | 'modifyLoginInfo' | 'signup';
|
||||
|
||||
@Component({
|
||||
selector: 'app-auth',
|
||||
templateUrl: './auth.component.html',
|
||||
imports: [LoginComponent, OTPComponent, ModifyLoginInfoComponent, SignupComponent],
|
||||
imports: [LoginComponent],
|
||||
})
|
||||
export class AuthComponent {
|
||||
@Input() redirectUrl!: string;
|
||||
@@ -39,11 +36,11 @@ export class AuthComponent {
|
||||
|
||||
onLoggedIn = (data: IAuthResponse) => {
|
||||
this.toastService.success({ text: 'شما با موفقیت وارد شدید.' });
|
||||
this.selectedRole.set(data.role.toUpperCase() as TRoles);
|
||||
if (data.mustChangePassword) {
|
||||
this.activeStep.set('modifyLoginInfo');
|
||||
return;
|
||||
}
|
||||
this.selectedRole.set(data.account.type.toUpperCase() as TRoles);
|
||||
// if (data.mustChangePassword) {
|
||||
// this.activeStep.set('modifyLoginInfo');
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (this.submit.observed) {
|
||||
return this.submit.emit(Promise.resolve(true));
|
||||
@@ -63,17 +60,17 @@ export class AuthComponent {
|
||||
|
||||
if (!redirectUrl) {
|
||||
switch (this.selectedRole()) {
|
||||
case 'SCHOOL':
|
||||
redirectUrl = '/schools';
|
||||
case 'SUPERADMIN':
|
||||
redirectUrl = '/super_admin';
|
||||
break;
|
||||
case 'ADMIN':
|
||||
redirectUrl = '/admin';
|
||||
break;
|
||||
case 'TEACHER':
|
||||
redirectUrl = '/teachers';
|
||||
case 'POS':
|
||||
redirectUrl = '/poss';
|
||||
break;
|
||||
case 'STUDENTS':
|
||||
redirectUrl = '/students';
|
||||
case 'PARTNER':
|
||||
redirectUrl = '/partner';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user