Skip to content
This repository has been archived by the owner on Mar 25, 2023. It is now read-only.

Commit

Permalink
fet(custom-scripts): added custom scripts support (#1425)
Browse files Browse the repository at this point in the history
  • Loading branch information
dron8552 committed Mar 6, 2019
1 parent 0fc8d01 commit cc4f2aa
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"src/i18n",
"src/css",
"src/img",
"src/scripts",
"src/agreements",
"src/support"
],
Expand Down
17 changes: 15 additions & 2 deletions src/app/reducers/auth/redux/auth.effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ import { Injectable } from '@angular/core';
import { Actions, Effect, ofType } from '@ngrx/effects';
import { Action } from '@ngrx/store';
import { Observable, of } from 'rxjs';
import { catchError, map, switchMap } from 'rxjs/operators';
import { catchError, map, switchMap, tap } from 'rxjs/operators';

import * as authActions from './auth.actions';
import { Account } from '../../../shared/models';
import { AccountService } from '../../../shared/services/account.service';
import { LocalStorageService } from '../../../shared/services/local-storage.service';

@Injectable()
export class UserAccountEffects {
Expand All @@ -23,5 +24,17 @@ export class UserAccountEffects {
}),
);

constructor(private actions$: Actions, private accountService: AccountService) {}
@Effect({ dispatch: false })
loadUserAccountResponse$: Observable<Action> = this.actions$.pipe(
ofType(authActions.LOAD_USER_ACCOUNT_RESPONSE),
tap((action: authActions.LoadUserAccountResponse) => {
this.storage.write('userAccount', JSON.stringify(action.payload));
}),
);

constructor(
private actions$: Actions,
private accountService: AccountService,
private storage: LocalStorageService,
) {}
}
1 change: 1 addition & 0 deletions src/app/shared/services/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ export class AuthService extends BaseBackendService<BaseModel> {
private setLoggedOut(): void {
this.userSubject.next(null);
this.storage.remove('user');
this.storage.remove('userAccount');
this.loggedIn.next(false);
}
}
1 change: 1 addition & 0 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<link rel="stylesheet" href="css/loader.css" />
<link rel="stylesheet" href="css/custom.css" />
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=Intl.~locale.en,Intl.~locale.ru"></script>
<script defer src="scripts/custom.js"></script>
</head>
<body>
<cs-app>
Expand Down
Empty file added src/scripts/custom.js
Empty file.

0 comments on commit cc4f2aa

Please sign in to comment.