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