SES-123 #41

Merged
s426128 merged 4 commits from SES-123 into dev 2020-12-27 22:06:01 +01:00
3 changed files with 14 additions and 8 deletions
Showing only changes of commit e17e3ace58 - Show all commits

View File

@ -23,9 +23,9 @@ import {
import {UserService} from '../services/user.service';
import { StoreModule } from '@ngrx/store';
import { StoreDevtoolsModule } from '@ngrx/store-devtools';
import {AppReducer} from './store/reducers/app.reducer';
import {environment} from '../environments/environment';
import {SessionCompanionIconsModule} from './shared/sc-icons/session-companion-icons.module';
import {reducers} from './store/models/app-state.model';
@NgModule({
declarations: [
@ -55,7 +55,7 @@ BrowserModule.withServerTransition({ appId: 'ng-cli-universal' }),
MatToolbarModule,
MatListModule,
SessionCompanionIconsModule,
StoreModule.forRoot({appState: AppReducer}),
StoreModule.forRoot(reducers),
StoreDevtoolsModule.instrument({
logOnly: environment.production
})

View File

@ -6,7 +6,7 @@ import {ErrorResponse} from '../../../types/ErrorResponse';
import {Observable, Subscription} from 'rxjs';
import {HttpErrorResponse} from '@angular/common/http';
import {AppStoreModel} from '../../store/models/app-store.model';
import { Store } from '@ngrx/store';
import {select, Store} from '@ngrx/store';
import {AddUserId} from '../../store/actions/app.actions';
import {AppState} from 'src/app/store/models/app-state.model';
@ -38,14 +38,14 @@ export class SignInComponent implements OnDestroy, OnInit {
});
ngOnInit() {
this.role$ = this.store.select(s => s.appState);
this.role$ = this.store.select(s => s.appStore);
}
onLoginButtonClick() {
let role = '';
this.store.select(s => s.appState.role).subscribe((v) => {
this.store.select(s => s.appStore.role).subscribe((v) => {
role = v;
});
}).unsubscribe();
this.allSubscriptions.add(
this.userService.tryLogin(
this.signInFormGroup.get('signIn').value['username'],

View File

@ -1,5 +1,11 @@
import {AppStoreModel} from './app-store.model';
import {ActionReducerMap} from '@ngrx/store';
import {AppReducer} from '../reducers/app.reducer';
export interface AppState {
appState: AppStoreModel;
appStore: AppStoreModel;
}
export const reducers: ActionReducerMap<AppState> = {
appStore: AppReducer,
};