Skip to content

Commit

Permalink
[Issue #171] Fix bad state feature names.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcpierce committed Mar 7, 2020
1 parent 11fb921 commit 675b2e7
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
} from '../actions/build-details.actions';
import { BuildDetails } from 'app/backend-status/models/build-details';

export const BUILD_DETAILS_FEATURE_KEY = 'buildDetails';
export const BUILD_DETAILS_FEATURE_KEY = 'build_details';

export interface BuildDetailsState {
fetching_details: boolean;
Expand Down
10 changes: 7 additions & 3 deletions comixed-frontend/src/app/library/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import { LibraryState } from './reducers/library.reducer';
import * as fromSelection from './reducers/selection.reducer';
import { SelectionState } from './reducers/selection.reducer';
import * as fromDupePages from './reducers/duplicate-pages.reducer';
import * as fromReadingLists from './reducers/reading-list.reducer';
import { ReadingListState } from './reducers/reading-list.reducer';
import { Params } from '@angular/router';
import { ActionReducerMap, MetaReducer } from '@ngrx/store';
import { environment } from '../../environments/environment';
Expand All @@ -40,18 +42,20 @@ interface RouterStateUrl {

export interface AppState {
router: fromRouter.RouterReducerState<RouterStateUrl>;
library: LibraryState;
library_state: LibraryState;
selection_state: SelectionState;
duplicate_pages_state: DuplicatePagesState;
reading_list_state: ReadingListState;
}

export type State = AppState;

export const reducers: ActionReducerMap<AppState> = {
router: fromRouter.routerReducer,
library: fromLibrary.reducer,
library_state: fromLibrary.reducer,
selection_state: fromSelection.reducer,
duplicate_pages_state: fromDupePages.reducer
duplicate_pages_state: fromDupePages.reducer,
reading_list_state: fromReadingLists.reducer
};

export const metaReducers: MetaReducer<AppState>[] = !environment.production
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const initial_state: ReadingListState = {
saving_reading_list_failed: false
};

export const READING_LIST_FEATURE_KEY = 'readingList';
export const READING_LIST_FEATURE_KEY = 'reading_list_state';

export function reducer(
state = initial_state,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@

import { Injectable } from '@angular/core';
import { Store } from '@ngrx/store';
import { AppState } from 'app/library';
import { Roles } from 'app/models/ui/roles';
import { User } from 'app/user';
import { AppState, User } from 'app/user';
import {
AuthCheckState,
AuthHideLogin,
Expand All @@ -32,6 +31,7 @@ import {
import { AuthenticationState } from 'app/user/models/authentication-state';
import { BehaviorSubject, Observable } from 'rxjs';
import { filter } from 'rxjs/operators';
import { AUTHENTICATION_FEATURE_KEY } from 'app/user/reducers/authentication.reducer';

@Injectable()
export class AuthenticationAdaptor {
Expand All @@ -47,7 +47,7 @@ export class AuthenticationAdaptor {

constructor(private store: Store<AppState>) {
this.store
.select('auth_state')
.select(AUTHENTICATION_FEATURE_KEY)
.pipe(filter(state => !!state))
.subscribe((auth_state: AuthenticationState) => {
this._initialized$.next(auth_state.initialized);
Expand Down
10 changes: 5 additions & 5 deletions comixed-frontend/src/app/user/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ import {
import * as fromRouter from '@ngrx/router-store';
import * as fromAuth from './reducers/authentication.reducer';
import * as fromUserAdmin from './reducers/user-admin.reducer';
import { UserAdminState } from './reducers/user-admin.reducer';
import { ActionReducerMap, MetaReducer } from '@ngrx/store';
import { environment } from '../../environments/environment';
import { Params } from '@angular/router';
import { AuthenticationState } from './models/authentication-state';
import { UserAdminState } from './reducers/user-admin.reducer';

export { User } from './models/user';
export { Role } from './models/role';
Expand Down Expand Up @@ -63,16 +63,16 @@ interface RouterStateUrl {

export interface AppState {
router: fromRouter.RouterReducerState<RouterStateUrl>;
user: AuthenticationState;
userAdmin: UserAdminState;
auth_state: AuthenticationState;
user_admin_state: UserAdminState;
}

export type State = AppState;

export const reducers: ActionReducerMap<AppState> = {
router: fromRouter.routerReducer,
user: fromAuth.reducer,
userAdmin: fromUserAdmin.reducer
auth_state: fromAuth.reducer,
user_admin_state: fromUserAdmin.reducer
};

export const metaReducers: MetaReducer<AppState>[] = !environment.production
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
} from '../actions/user-admin.actions';
import { User } from 'app/user';

export const USER_ADMIN_FEATURE_KEY = 'userAdmin';
export const USER_ADMIN_FEATURE_KEY = 'user_admin_state';

export interface UserAdminState {
fetchingAll: boolean;
Expand Down

0 comments on commit 675b2e7

Please sign in to comment.