File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
src/context/auth/application/facades Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { AuthUser } from '../../domain/user/user.entity';
44import { AuthStatePort } from '../../domain/port/auth-state.port' ;
55import { LogoutUseCase } from '../logout.use-case' ;
66import { InitializeAuthUseCase } from '../initialize-auth.use-case' ;
7+ import { CreateUserUseCase } from '../create-user.use-case' ;
78
89@Injectable ( )
910export class AuthFacade {
@@ -16,6 +17,7 @@ export class AuthFacade {
1617 private readonly logoutUseCase : LogoutUseCase ,
1718 private readonly authStatePort : AuthStatePort ,
1819 private readonly initializeAuthUseCase : InitializeAuthUseCase ,
20+ private readonly createUserUseCase : CreateUserUseCase ,
1921 ) { }
2022
2123 async login ( email : string , password : string ) : Promise < AuthUser > {
@@ -35,6 +37,15 @@ export class AuthFacade {
3537 this . authStatePort . clearUser ( ) ;
3638 }
3739
40+ async singUp ( email : string , password : string ) : Promise < void > {
41+ const result = await this . createUserUseCase . execute ( email , password ) ;
42+
43+ if ( result ) {
44+ const user = result ;
45+ this . authStatePort . setUser ( user ) ;
46+ }
47+ }
48+
3849 async initialize ( ) : Promise < void > {
3950 const result = await this . initializeAuthUseCase . execute ( ) ;
4051
You can’t perform that action at this time.
0 commit comments