Commit cd4b1d46 authored by dev0tion's avatar dev0tion

Add logout confirmation

parent 08e79797
......@@ -19,6 +19,7 @@ import { GlobalService } from './shared/services/global.service';
import { SendComponent } from './wallet/send/send.component';
import { ReceiveComponent } from './wallet/receive/receive.component';
import { TransactionDetailsComponent } from './wallet/transaction-details/transaction-details.component';
import { LogoutConfirmationComponent } from './wallet/logout-confirmation/logout-confirmation.component';
@NgModule({
......@@ -36,6 +37,7 @@ import { TransactionDetailsComponent } from './wallet/transaction-details/transa
declarations: [
AppComponent,
LoginComponent,
LogoutConfirmationComponent,
SendComponent,
ReceiveComponent,
TransactionDetailsComponent
......@@ -43,7 +45,8 @@ import { TransactionDetailsComponent } from './wallet/transaction-details/transa
entryComponents: [
SendComponent,
ReceiveComponent,
TransactionDetailsComponent
TransactionDetailsComponent,
LogoutConfirmationComponent
],
providers: [ ApiService, GlobalService ],
bootstrap: [ AppComponent ]
......
<div id="modalLogout" tabindex="-1" role="dialog" aria-labelledby="modal_logout" aria-hidden="true">
<div class="modal-dialog" role="document">
<div>
<div class="modal-header">
<div class="bubble"><i class="icon-download"></i></div>
</div>
<div class="modal-body">
<h5 class="modal-title text-uppercase" id="modalReceive">Logout</h5>
<form>
<div class="form-group clearfix">
<label class="float-left">Are you sure you want to logout?</label>
</div>
<div>
<button type="button" class="btn btn-lg btn-primary float-left" data-dismiss="modal" aria-label="Logout" (click)="onLogout()">Yes</button>
<button type="button" class="btn btn-lg btn-primary float-right" data-dismiss="modal" aria-label="Close" (click)="activeModal.close('Close click')">Cancel</button>
</div>
<br>
</form>
</div>
<div class="modal-footer">
<p></p>
</div>
</div>
</div>
</div>
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { LogoutConfirmationComponent } from './logout-confirmation.component';
describe('LogoutConfirmationComponent', () => {
let component: LogoutConfirmationComponent;
let fixture: ComponentFixture<LogoutConfirmationComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ LogoutConfirmationComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(LogoutConfirmationComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should be created', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import {NgbModal, NgbActiveModal} from '@ng-bootstrap/ng-bootstrap';
@Component({
selector: 'app-logout-confirmation',
templateUrl: './logout-confirmation.component.html',
styleUrls: ['./logout-confirmation.component.css']
})
export class LogoutConfirmationComponent implements OnInit {
constructor(private activeModal: NgbActiveModal, private router: Router) { }
ngOnInit() {
}
private onLogout() {
this.activeModal.close();
this.router.navigate(['/login']);
}
}
import { Component } from '@angular/core';
import { Router } from '@angular/router';
import { NgbModal, NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { LogoutConfirmationComponent } from '../logout-confirmation/logout-confirmation.component';
@Component({
selector: 'app-menu',
......@@ -7,9 +10,9 @@ import { Router } from '@angular/router';
styleUrls: ['./menu.component.css'],
})
export class MenuComponent {
constructor(private router: Router) {}
constructor(private modalService: NgbModal) {}
private logOut() {
this.router.navigate(['/login']);
const modalRef = this.modalService.open(LogoutConfirmationComponent);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment