nakedobjects.spa
Version:
Single Page Application client for a Naked Objects application.
72 lines • 3.17 kB
JavaScript
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { ContextService } from '../context.service';
import { Component } from '@angular/core';
import { ConfigService } from '../config.service';
import { AuthService } from '../auth.service';
import { Http } from '@angular/http';
import { UrlManagerService } from '../url-manager.service';
import { Location } from '@angular/common';
var LogoffComponent = (function () {
function LogoffComponent(context, authService, configService, http, urlManager, location) {
this.context = context;
this.authService = authService;
this.configService = configService;
this.http = http;
this.urlManager = urlManager;
this.location = location;
this.isActive = true;
}
LogoffComponent.prototype.userIsLoggedIn = function () {
return this.authService.userIsLoggedIn();
};
LogoffComponent.prototype.cancel = function () {
this.isActive = false;
this.location.back();
};
LogoffComponent.prototype.logoff = function () {
this.isActive = false;
var serverLogoffUrl = this.configService.config.logoffUrl;
var postLogoffUrl = this.configService.config.postLogoffUrl;
if (serverLogoffUrl) {
var args = {
withCredentials: true
};
this.http.post(this.configService.config.logoffUrl, args);
}
// logoff client without waiting for server
this.authService.logout();
// if set this will reload page and cause all cached data to be lost.
if (postLogoffUrl) {
this.context.clearingDataFlag = true;
window.location.href = postLogoffUrl;
}
};
LogoffComponent.prototype.ngOnInit = function () {
var _this = this;
this.context.getUser().then(function (u) { return _this.userId = u.userName() || "Unknown"; });
};
return LogoffComponent;
}());
LogoffComponent = __decorate([
Component({
selector: 'nof-logoff',
template: require('./logoff.component.html'),
styles: [require('./logoff.component.css')]
}),
__metadata("design:paramtypes", [ContextService,
AuthService,
ConfigService,
Http,
UrlManagerService,
Location])
], LogoffComponent);
export { LogoffComponent };
//# sourceMappingURL=logoff.component.js.map