account_circle
{{character.name}}
- arrow_forward
+ arrow_forward
{{character.className}} level: {{character.level}}
diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/select-character/select-character.component.ts b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/select-character/select-character.component.ts
index 0581f28..5331821 100644
--- a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/select-character/select-character.component.ts
+++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/select-character/select-character.component.ts
@@ -8,6 +8,7 @@ import {Store} from "@ngrx/store";
import {AppState} from "../../store/models/app-state.model";
import {CharacterService} from "../../../services/character.service";
import {CharacterForLoginViewModel} from "../../../types/viewmodels/character-viewmodels/CharacterForLoginViewModel";
+import {AddCharacterId} from "../../store/actions/player.action";
@Component({
selector: 'app-select-character',
@@ -36,7 +37,8 @@ export class SelectCharacterComponent implements OnInit {
});
}
- onCharacterClick(){
+ onCharacterClick(characterId: number){
+ this.store.dispatch(new AddCharacterId({characterId}))
this.router.navigate(['player'])
}
diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/store/actions/app.actions.ts b/SessionCompanion/SessionCompanion/ClientApp/src/app/store/actions/app.actions.ts
index 73a3584..362b983 100644
--- a/SessionCompanion/SessionCompanion/ClientApp/src/app/store/actions/app.actions.ts
+++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/store/actions/app.actions.ts
@@ -1,5 +1,4 @@
-import {AppStoreModel} from '../models/app-store.model';
-import { Action } from '@ngrx/store';
+import {Action} from '@ngrx/store';
export enum AppActionTypes {
ADD_USER_ID = '[APP] Add user id',
@@ -26,7 +25,8 @@ export class ClearUserId implements Action {
constructor() {
}
-
}
+
+
export type AppAction = AddUserId | AddRole | ClearUserId;
diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/store/actions/player.action.ts b/SessionCompanion/SessionCompanion/ClientApp/src/app/store/actions/player.action.ts
new file mode 100644
index 0000000..45c74d8
--- /dev/null
+++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/store/actions/player.action.ts
@@ -0,0 +1,15 @@
+import {Action} from "@ngrx/store";
+
+export enum PlayerActionTypes {
+ ADD_CHARACTER_ID= '[PLAYER] Add character id'
+}
+
+export class AddCharacterId implements Action {
+ readonly type = PlayerActionTypes.ADD_CHARACTER_ID;
+
+ constructor(public payload: {characterId: number}) {
+
+ }
+}
+
+export type PlayerAction = AddCharacterId;
diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/store/models/app-state.model.ts b/SessionCompanion/SessionCompanion/ClientApp/src/app/store/models/app-state.model.ts
index 8d87023..7fda9a7 100644
--- a/SessionCompanion/SessionCompanion/ClientApp/src/app/store/models/app-state.model.ts
+++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/store/models/app-state.model.ts
@@ -1,11 +1,15 @@
import {AppStoreModel} from './app-store.model';
import {ActionReducerMap} from '@ngrx/store';
import {AppReducer} from '../reducers/app.reducer';
+import {PlayerStoreModel} from "./player-store.model";
+import {PlayerReducer} from "../reducers/player.reducer";
export interface AppState {
appStore: AppStoreModel;
+ playerStore: PlayerStoreModel;
}
export const reducers: ActionReducerMap