signin 수정
This commit is contained in:
parent
e286b6c316
commit
9d17726f92
|
@ -11,11 +11,20 @@
|
|||
></mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<fuse-alert
|
||||
class="mt-8 -mb-4"
|
||||
*ngIf="showAlert"
|
||||
[appearance]="'outline'"
|
||||
[showIcon]="false"
|
||||
[type]="alert.type"
|
||||
[@shake]="alert.type === 'error'"
|
||||
>
|
||||
{{ alert.message }}
|
||||
</fuse-alert>
|
||||
<!-- Compose form -->
|
||||
<form
|
||||
class="flex flex-col flex-auto p-6 sm:p-8 overflow-y-auto"
|
||||
[formGroup]="composeForm"
|
||||
[formGroup]="signInComposeForm"
|
||||
>
|
||||
<!-- 아이디 -->
|
||||
<mat-form-field>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import { MatDialogRef } from '@angular/material/dialog';
|
||||
import { FuseAlertType } from '@fuse/components/alert';
|
||||
import { AuthService } from 'app/core/auth/auth.service';
|
||||
|
||||
@Component({
|
||||
|
@ -9,19 +10,15 @@ import { AuthService } from 'app/core/auth/auth.service';
|
|||
encapsulation: ViewEncapsulation.None,
|
||||
})
|
||||
export class SignInComposeComponent implements OnInit {
|
||||
composeForm!: FormGroup;
|
||||
copyFields: { cc: boolean; bcc: boolean } = {
|
||||
cc: false,
|
||||
bcc: false,
|
||||
};
|
||||
quillModules: any = {
|
||||
toolbar: [
|
||||
['bold', 'italic', 'underline'],
|
||||
[{ align: [] }, { list: 'ordered' }, { list: 'bullet' }],
|
||||
['clean'],
|
||||
],
|
||||
signInComposeForm!: FormGroup;
|
||||
|
||||
alert: { type: FuseAlertType; message: string } = {
|
||||
type: 'success',
|
||||
message: '로그인이 성공하였습니다.',
|
||||
};
|
||||
|
||||
showAlert: boolean = false;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
|
@ -40,9 +37,9 @@ export class SignInComposeComponent implements OnInit {
|
|||
*/
|
||||
ngOnInit(): void {
|
||||
// Create the form
|
||||
this.composeForm = this._formBuilder.group({
|
||||
username: ['', [Validators.required, Validators.email]],
|
||||
password: ['', [Validators.email]],
|
||||
this.signInComposeForm = this._formBuilder.group({
|
||||
username: ['', [Validators.required]],
|
||||
password: ['', [Validators.required]],
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -50,21 +47,6 @@ export class SignInComposeComponent implements OnInit {
|
|||
// @ Public methods
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Show the copy field with the given field name
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
showCopyField(name: string): void {
|
||||
// Return if the name is not one of the available names
|
||||
if (name !== 'cc' && name !== 'bcc') {
|
||||
return;
|
||||
}
|
||||
|
||||
// Show the field
|
||||
this.copyFields[name] = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save and close
|
||||
*/
|
||||
|
@ -91,20 +73,25 @@ export class SignInComposeComponent implements OnInit {
|
|||
*/
|
||||
send(): void {
|
||||
// Return if the form is invalid
|
||||
if (this.composeForm?.invalid) {
|
||||
if (this.signInComposeForm?.invalid) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Disable the form
|
||||
this.composeForm?.disable();
|
||||
this.signInComposeForm?.disable();
|
||||
|
||||
// Sign in
|
||||
this._authService
|
||||
.signIn(this.composeForm?.value)
|
||||
.then(() => {})
|
||||
.signIn(this.signInComposeForm?.value)
|
||||
.then(() => {
|
||||
console.log();
|
||||
this.showAlert = true;
|
||||
})
|
||||
.catch((e) => {
|
||||
this.showAlert = true;
|
||||
this.alert = { type: 'error', message: '등록에 실패하였습니다.' };
|
||||
// Re-enable the form
|
||||
this.composeForm?.enable();
|
||||
this.signInComposeForm?.enable();
|
||||
|
||||
// Reset the form
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user