mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-04-12 09:31:28 +03:00
Added ability to set a pin for settings menu
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { MatDialogRef } from '@angular/material/dialog';
|
||||
import { PostsService } from 'app/posts.services';
|
||||
|
||||
@Component({
|
||||
selector: 'app-pin-login',
|
||||
templateUrl: './pin-login-dialog.component.html',
|
||||
styleUrls: ['./pin-login-dialog.component.scss']
|
||||
})
|
||||
export class PinLoginComponent {
|
||||
pin: string;
|
||||
enterClicked = false;
|
||||
|
||||
constructor(private postsService: PostsService, private dialogRef: MatDialogRef<PinLoginComponent>) {
|
||||
}
|
||||
|
||||
pinLogin() {
|
||||
this.enterClicked = true;
|
||||
this.postsService.pinLogin(this.pin).subscribe(res => {
|
||||
this.enterClicked = false;
|
||||
if (!res['pin_token']) {
|
||||
this.postsService.openSnackBar($localize`Pin failed!`);
|
||||
} else {
|
||||
this.postsService.httpOptions.params = this.postsService.httpOptions.params.set('pin_token', res['pin_token']);
|
||||
}
|
||||
this.dialogRef.close(res['pin_token']);
|
||||
}, err => {
|
||||
this.enterClicked = false;
|
||||
this.postsService.openSnackBar($localize`Pin failed!`);
|
||||
console.error(err);
|
||||
this.dialogRef.close(false);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user