mirror of
https://github.com/NicolasConstant/sengi
synced 2025-02-01 11:06:54 +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"
|
||||
placeholder="@nickname@mastodon.social" />
|
||||
<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>
|
||||
|
||||
<div *ngIf="isComrade" class="comrade__video">
|
||||
|
@ -20,6 +20,8 @@ export class AddNewAccountComponent implements OnInit {
|
||||
private instance: string;
|
||||
isComrade: boolean;
|
||||
|
||||
isLoading: boolean;
|
||||
|
||||
private _mastodonFullHandle: string;
|
||||
@Input()
|
||||
set mastodonFullHandle(value: string) {
|
||||
@ -57,17 +59,20 @@ export class AddNewAccountComponent implements OnInit {
|
||||
}
|
||||
|
||||
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.isLoading = true;
|
||||
this.checkAndCreateApplication(this.instance)
|
||||
.then((appData: AppData) => {
|
||||
this.redirectToInstanceAuthPage(this.username, this.instance, appData);
|
||||
})
|
||||
.then(x => {
|
||||
setTimeout(() => {
|
||||
this.isLoading = false;
|
||||
}, 1000);
|
||||
})
|
||||
.catch((err: HttpErrorResponse) => {
|
||||
this.isLoading = false;
|
||||
if (err instanceof HttpErrorResponse) {
|
||||
this.notificationService.notifyHttpError(err, null);
|
||||
} else if ((<Error>err).message === 'CORS') {
|
||||
|
Loading…
x
Reference in New Issue
Block a user