Browse Source

fix(core): localizationInitialize function state selector error

pull/1841/head
mehmet-erim 6 years ago
parent
commit
08d013ebc4
  1. 3
      npm/ng-packs/packages/core/src/lib/services/rest.service.ts
  2. 2
      npm/ng-packs/packages/core/src/lib/utils/initial-utils.ts
  3. 2
      npm/ng-packs/packages/theme-shared/package.json
  4. 20
      npm/ng-packs/packages/theme-shared/src/lib/components/change-password/change-password.component.ts

3
npm/ng-packs/packages/core/src/lib/services/rest.service.ts

@ -5,6 +5,7 @@ import { Observable, throwError } from 'rxjs';
import { catchError, take } from 'rxjs/operators';
import { RestOccurError } from '../actions/rest.actions';
import { Rest } from '../models/rest';
import { ConfigState } from '../states/config.state';
@Injectable({
providedIn: 'root',
@ -20,7 +21,7 @@ export class RestService {
request<T, R>(request: HttpRequest<T> | Rest.Request<T>, config: Rest.Config = {}, api?: string): Observable<R> {
const { observe = Rest.Observe.Body, skipHandleError } = config;
const url = api || this.store.selectSnapshot(state => state.ConfigState).environment.apis.default.url + request.url;
const url = api || this.store.selectSnapshot(ConfigState.getApiUrl()) + request.url;
const { method, ...options } = request;
return this.http.request<T>(method, url, { observe, ...options } as any).pipe(
observe === Rest.Observe.Body ? take(1) : null,

2
npm/ng-packs/packages/core/src/lib/utils/initial-utils.ts

@ -18,7 +18,7 @@ export function localeInitializer(injector: Injector) {
const fn = () => {
const store: Store = injector.get(Store);
const lang = store.selectSnapshot(state => state.SessionState.getLanguage) || 'en';
const lang = store.selectSnapshot(state => state.SessionState.language) || 'en';
return new Promise((resolve, reject) => {
registerLocale(lang).then(() => resolve(), reject);

2
npm/ng-packs/packages/theme-shared/package.json

@ -5,7 +5,7 @@
"@abp/ng.core": "^0.9.0",
"@angular/cdk": "^8.0.1",
"@ng-bootstrap/ng-bootstrap": "^5.1.0",
"@ngx-validate/core": "^0.0.5",
"@ngx-validate/core": "^0.0.7",
"bootstrap": "^4.3.1",
"chart.js": "^2.8.0",
"font-awesome": "^4.7.0",

20
npm/ng-packs/packages/theme-shared/src/lib/components/change-password/change-password.component.ts

@ -8,7 +8,7 @@ import {
Output,
SimpleChanges,
TemplateRef,
ViewChild
ViewChild,
} from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { comparePasswords, Validation } from '@ngx-validate/core';
@ -23,7 +23,7 @@ const PASSWORD_FIELDS = ['newPassword', 'repeatNewPassword'];
@Component({
selector: 'abp-change-password',
templateUrl: './change-password.component.html'
templateUrl: './change-password.component.html',
})
export class ChangePasswordComponent implements OnInit, OnChanges {
protected _visible;
@ -60,11 +60,11 @@ export class ChangePasswordComponent implements OnInit, OnChanges {
{
password: ['', required],
newPassword: ['', required],
repeatNewPassword: ['', required]
repeatNewPassword: ['', required],
},
{
validators: [comparePasswords(PASSWORD_FIELDS)]
}
validators: [comparePasswords(PASSWORD_FIELDS)],
},
);
}
@ -76,13 +76,13 @@ export class ChangePasswordComponent implements OnInit, OnChanges {
.dispatch(
new ChangePassword({
currentPassword: this.form.get('password').value,
newPassword: this.form.get('newPassword').value
})
newPassword: this.form.get('newPassword').value,
}),
)
.pipe(
finalize(() => {
this.modalBusy = false;
})
}),
)
.subscribe({
next: () => {
@ -91,9 +91,9 @@ export class ChangePasswordComponent implements OnInit, OnChanges {
},
error: err => {
this.toasterService.error(snq(() => err.error.error.message, 'AbpAccount::DefaultErrorMessage'), 'Error', {
life: 7000
life: 7000,
});
}
},
});
}

Loading…
Cancel
Save