disable register btn on click
This commit is contained in:
parent
5aaf762481
commit
8dbf568d79
3 changed files with 20 additions and 7 deletions
|
|
@ -45,14 +45,22 @@
|
||||||
<div class="ownAvatarContainer">
|
<div class="ownAvatarContainer">
|
||||||
<div>{{ "chooseAvatar.ownAvatar" | translate }}</div>
|
<div>{{ "chooseAvatar.ownAvatar" | translate }}</div>
|
||||||
<div>
|
<div>
|
||||||
<button class="BtnUpload" (click)="fileInput.click()">
|
<button
|
||||||
|
class="BtnUpload"
|
||||||
|
(click)="fileInput.click()"
|
||||||
|
[disabled]="loginService.isBtnDisabled"
|
||||||
|
>
|
||||||
{{ "chooseAvatar.avatarBtn" | translate }}
|
{{ "chooseAvatar.avatarBtn" | translate }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="avatarBottom">
|
<div class="avatarBottom">
|
||||||
<button class="hoverBtn" (click)="loginService.register()">
|
<button
|
||||||
|
class="aktivButton"
|
||||||
|
(click)="loginService.register()"
|
||||||
|
[disabled]="loginService.isBtnDisabled"
|
||||||
|
>
|
||||||
{{ "chooseAvatar.Btn" | translate }}
|
{{ "chooseAvatar.Btn" | translate }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,9 @@ section {
|
||||||
background-color: #444df2;
|
background-color: #444df2;
|
||||||
color: #ffff;
|
color: #ffff;
|
||||||
}
|
}
|
||||||
|
&:disabled {
|
||||||
|
@include buttonGrey;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.avatarBottom {
|
.avatarBottom {
|
||||||
|
|
@ -89,9 +92,10 @@ button {
|
||||||
@include buttonGrey;
|
@include buttonGrey;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
.hoverBtn {
|
.aktivButton {
|
||||||
&:hover {
|
@include aktivButtonBlue;
|
||||||
background-color: #676eec;
|
&:disabled {
|
||||||
|
@include buttonGrey;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@media (max-width: 570px) {
|
@media (max-width: 570px) {
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,7 @@ export class loginService {
|
||||||
let currentUser = this.userService.getCurrentUserId();
|
let currentUser = this.userService.getCurrentUserId();
|
||||||
if (currentUser !== null) {
|
if (currentUser !== null) {
|
||||||
this.router.navigate([`/main`]);
|
this.router.navigate([`/main`]);
|
||||||
|
this.isBtnDisabled = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -88,7 +89,6 @@ export class loginService {
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error('Error when retrieving the user document:', error);
|
console.error('Error when retrieving the user document:', error);
|
||||||
});
|
});
|
||||||
this.isBtnDisabled = false;
|
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
const errorCode = error.code;
|
const errorCode = error.code;
|
||||||
|
|
@ -154,7 +154,6 @@ export class loginService {
|
||||||
this.getUserIdInLocalStorage(userId);
|
this.getUserIdInLocalStorage(userId);
|
||||||
this.email = '';
|
this.email = '';
|
||||||
this.password = '';
|
this.password = '';
|
||||||
this.isBtnDisabled = false;
|
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
|
@ -171,6 +170,7 @@ export class loginService {
|
||||||
* Registers a new user with Firebase authentication and stores user data in Firestore.
|
* Registers a new user with Firebase authentication and stores user data in Firestore.
|
||||||
*/
|
*/
|
||||||
register() {
|
register() {
|
||||||
|
this.isBtnDisabled = true;
|
||||||
const auth = getAuth();
|
const auth = getAuth();
|
||||||
createUserWithEmailAndPassword(auth, this.email, this.password)
|
createUserWithEmailAndPassword(auth, this.email, this.password)
|
||||||
.then((userCredential) => {
|
.then((userCredential) => {
|
||||||
|
|
@ -190,6 +190,7 @@ export class loginService {
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
this.deleteUserFormData();
|
this.deleteUserFormData();
|
||||||
|
this.isBtnDisabled = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue