本文整理匯總了TypeScript中app/main.angularApp.logService類的典型用法代碼示例。如果您正苦於以下問題:TypeScript angularApp.logService類的具體用法?TypeScript angularApp.logService怎麽用?TypeScript angularApp.logService使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了angularApp.logService類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: login
public login(loginData: ILoginModel): ng.IPromise<ILoginResponseModel> {
angularApp.logService.debug("authentication.service - login ...");
// eliminar datos de logon si ya se esta logueado
if (this.AuthenticationData) {
this.logOut();
}
let params: any = {
grant_type: "password",
password: loginData.password,
username: loginData.username
};
if (loginData.useRefreshTokens) {
params.client_id = APP_NAME;
}
return this._http({
data: $.param(params),
headers: { "Content-Type": "application/x-www-form-urlencoded" },
method: "POST",
url: API_BASE_URL + "token"
})
.then((resultCallback: ng.IHttpPromiseCallbackArg<any>): ILoginResponseModel => {
angularApp.logService.debug("authentication.service - login: " + angular.toJson(resultCallback.data));
let now: Date = new Date();
let loginResponse: ILoginResponseModel = {
lastRequestDateTime: now,
loginDateTime: now,
refreshToken: loginData.useRefreshTokens ? resultCallback.data.refresh_token : "",
token: resultCallback.data.access_token,
useRefreshTokens: loginData.useRefreshTokens ? true : false,
userName: loginData.username
};
this._localStorageService.set(LOCAL_STORAGE_AUTH_KEY, loginResponse);
this._rootScope.$emit(EVT_LOGIN);
return loginResponse;
})
.catch((reason: any) => {
angularApp.logService.error("Error: auth.service - login: " + angular.toJson(reason.data));
this.logOut();
return this._q.reject(reason);
});
}
示例2: Date
.then((resultCallback: ng.IHttpPromiseCallbackArg<any>): ILoginResponseModel => {
angularApp.logService.debug("authentication.service - login: " + angular.toJson(resultCallback.data));
let now: Date = new Date();
let loginResponse: ILoginResponseModel = {
lastRequestDateTime: now,
loginDateTime: now,
refreshToken: loginData.useRefreshTokens ? resultCallback.data.refresh_token : "",
token: resultCallback.data.access_token,
useRefreshTokens: loginData.useRefreshTokens ? true : false,
userName: loginData.username
};
this._localStorageService.set(LOCAL_STORAGE_AUTH_KEY, loginResponse);
this._rootScope.$emit(EVT_LOGIN);
return loginResponse;
})
示例3:
.catch((reason: any) => {
angularApp.logService.error(`Error - ${url}: ${angular.toJson(reason)}`);
return this._q.reject(reason);
});
示例4: logOut
public logOut(): void {
this._localStorageService.remove(LOCAL_STORAGE_AUTH_KEY);
this._rootScope.$emit(EVT_LOGOUT);
angularApp.logService.debug("authentication.service - logOut");
}
示例5:
.catch((reason: any) => {
angularApp.logService.error("Error: auth.service - login: " + angular.toJson(reason.data));
this.logOut();
return this._q.reject(reason);
});