various empty lines deleted
This commit is contained in:
parent
1f3ed57c4b
commit
ce98ec1cd3
|
|
@ -1,7 +1,6 @@
|
|||
<app-header [userEmail]="connectedUserEmail()" />
|
||||
<main>
|
||||
<app-sidebar [userEmail]="connectedUserEmail()">
|
||||
|
||||
</app-sidebar>
|
||||
<router-outlet />
|
||||
</main>
|
||||
|
|
|
|||
|
|
@ -1,14 +1,16 @@
|
|||
export interface User {
|
||||
email: string,
|
||||
password: string,
|
||||
roles: string[]
|
||||
roles: string[],
|
||||
favorites: string[],
|
||||
}
|
||||
|
||||
|
||||
export interface LoggedUser {
|
||||
email: string,
|
||||
token: string,
|
||||
roles: string[]
|
||||
roles: string[],
|
||||
favorites: string[],
|
||||
}
|
||||
|
||||
export interface UserToRegister {
|
||||
|
|
@ -19,4 +21,5 @@ export interface UserToRegister {
|
|||
cityCode: string,
|
||||
city: string,
|
||||
phone: string,
|
||||
favorites: string[],
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ export class Login {
|
|||
}
|
||||
|
||||
async login() {
|
||||
const userToConnect : User = {email: this.email(), password: this.password(),roles: []}
|
||||
const userToConnect : User = {email: this.email(), password: this.password(),roles: [], favorites: []}
|
||||
try{
|
||||
const loginSuccess =await firstValueFrom(this.userService.login(userToConnect));
|
||||
if(loginSuccess){
|
||||
|
|
|
|||
|
|
@ -50,7 +50,8 @@ export class Auth {
|
|||
passwordConfirm: user.passwordConfirm,
|
||||
cityCode: user.cityCode,
|
||||
city: user.city,
|
||||
phone: user.phone };
|
||||
phone: user.phone,
|
||||
favorites: user.favorites };
|
||||
const headers = new HttpHeaders({ 'Content-Type': 'application/json' });
|
||||
|
||||
return this.http.post<ApiResponse<LoggedUser>>(apiUrl, requestBody, { headers }).pipe(
|
||||
|
|
@ -88,7 +89,8 @@ export class Auth {
|
|||
const userStoreData: LoggedUser = {
|
||||
email: res.data.email,
|
||||
token: res.data.token,
|
||||
roles: res.data.roles || []
|
||||
roles: res.data.roles || [],
|
||||
favorites: res.data.roles || []
|
||||
};
|
||||
sessionStorage.setItem('connectedUser', JSON.stringify(userStoreData));
|
||||
this.connectedUserSignal.set(userStoreData);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { Auth } from '../../services/auth';
|
|||
|
||||
@Component({
|
||||
selector: 'app-sidebar',
|
||||
imports: [],
|
||||
imports: [RouterLink],
|
||||
templateUrl: './sidebar.html',
|
||||
styleUrl: './sidebar.css'
|
||||
})
|
||||
|
|
@ -13,9 +13,7 @@ export class Sidebar {
|
|||
isLoggedIn = computed(()=>this.userEmail() !== null)
|
||||
currentUserEmail = computed(()=> this.userEmail());
|
||||
|
||||
|
||||
constructor(private readonly loginservice: Auth, private readonly router: Router){
|
||||
|
||||
}
|
||||
|
||||
logout(){
|
||||
|
|
|
|||
Loading…
Reference in New Issue