mirror of
https://github.com/NicolasConstant/sengi
synced 2025-02-08 07:58:47 +01:00
added loading icon on login
This commit is contained in:
parent
975b3a6e2b
commit
882d123881
@ -7,7 +7,8 @@
|
|||||||
<input type="text" class="form-control form-control-sm form-color" [(ngModel)]="mastodonFullHandle" name="mastodonFullHandle" [class.comrade__input]="isComrade"
|
<input type="text" class="form-control form-control-sm form-color" [(ngModel)]="mastodonFullHandle" name="mastodonFullHandle" [class.comrade__input]="isComrade"
|
||||||
placeholder="@nickname@mastodon.social" />
|
placeholder="@nickname@mastodon.social" />
|
||||||
<br />
|
<br />
|
||||||
<button type="submit" class="btn btn-success btn-sm" [class.comrade__button]="isComrade">Submit</button>
|
<button *ngIf="!isLoading" type="submit" class="btn btn-success btn-sm" [class.comrade__button]="isComrade">Submit</button>
|
||||||
|
<app-waiting-animation *ngIf="isLoading" class="waiting-icon"></app-waiting-animation>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div *ngIf="isComrade" class="comrade__video">
|
<div *ngIf="isComrade" class="comrade__video">
|
||||||
|
@ -20,6 +20,8 @@ export class AddNewAccountComponent implements OnInit {
|
|||||||
private instance: string;
|
private instance: string;
|
||||||
isComrade: boolean;
|
isComrade: boolean;
|
||||||
|
|
||||||
|
isLoading: boolean;
|
||||||
|
|
||||||
private _mastodonFullHandle: string;
|
private _mastodonFullHandle: string;
|
||||||
@Input()
|
@Input()
|
||||||
set mastodonFullHandle(value: string) {
|
set mastodonFullHandle(value: string) {
|
||||||
@ -57,17 +59,20 @@ export class AddNewAccountComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onSubmit(): boolean {
|
onSubmit(): boolean {
|
||||||
// let fullHandle = this.mastodonFullHandle.split('@').filter(x => x != null && x !== '');
|
|
||||||
// const username = fullHandle[0];
|
|
||||||
// const instance = fullHandle[1];
|
|
||||||
|
|
||||||
this.checkBlockList(this.instance);
|
this.checkBlockList(this.instance);
|
||||||
|
|
||||||
|
this.isLoading = true;
|
||||||
this.checkAndCreateApplication(this.instance)
|
this.checkAndCreateApplication(this.instance)
|
||||||
.then((appData: AppData) => {
|
.then((appData: AppData) => {
|
||||||
this.redirectToInstanceAuthPage(this.username, this.instance, appData);
|
this.redirectToInstanceAuthPage(this.username, this.instance, appData);
|
||||||
})
|
})
|
||||||
|
.then(x => {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.isLoading = false;
|
||||||
|
}, 1000);
|
||||||
|
})
|
||||||
.catch((err: HttpErrorResponse) => {
|
.catch((err: HttpErrorResponse) => {
|
||||||
|
this.isLoading = false;
|
||||||
if (err instanceof HttpErrorResponse) {
|
if (err instanceof HttpErrorResponse) {
|
||||||
this.notificationService.notifyHttpError(err, null);
|
this.notificationService.notifyHttpError(err, null);
|
||||||
} else if ((<Error>err).message === 'CORS') {
|
} else if ((<Error>err).message === 'CORS') {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user