diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/app.module.ts b/SessionCompanion/SessionCompanion/ClientApp/src/app/app.module.ts index 1f42116..3a7f6a6 100644 --- a/SessionCompanion/SessionCompanion/ClientApp/src/app/app.module.ts +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/app.module.ts @@ -51,6 +51,10 @@ import { GameMasterMonstersTableComponent } from './components/game-master-monst import { MonsterService } from '../services/monster.service'; import { SpellDetailsDialogComponent } from './components/spell-details-dialog/spell-details-dialog.component'; import { GameMasterShopkeepersTableComponent } from './components/game-master-shopkeepers-table/game-master-shopkeepers-table.component'; +import { PlayerWeaponsTableComponent } from './components/player-weapons-table/player-weapons-table.component'; +import {EquipmentService} from "../services/equipment.service"; +import { PlayerArmorsTableComponent } from './components/player-armors-table/player-armors-table.component'; +import { PlayerOtherEquipmentTableComponent } from './components/player-other-equipment-table/player-other-equipment-table.component'; import { SendMessageActionComponent } from './components/game-master-character-actions-dialog/actions-components/send-message-action/send-message-action.component'; import { DynamicModule } from 'ng-dynamic-component'; import { SnackbarComponent } from './shared/snackbar/snackbar.component'; @@ -79,6 +83,9 @@ import { ShopkeeperService } from '../services/shopkeeper.service'; GameMasterMonstersTableComponent, SpellDetailsDialogComponent, GameMasterShopkeepersTableComponent, + PlayerWeaponsTableComponent, + PlayerArmorsTableComponent, + PlayerOtherEquipmentTableComponent, SendMessageActionComponent, SnackbarComponent, MessageDialogComponent, @@ -124,6 +131,7 @@ import { ShopkeeperService } from '../services/shopkeeper.service'; ArmorService, OtherEquipmentService, MonsterService, + EquipmentService, ShopkeeperService, ], bootstrap: [AppComponent], @@ -137,6 +145,9 @@ import { ShopkeeperService } from '../services/shopkeeper.service'; ThrowPrimaryAbilityComponent, SpellDetailsDialogComponent, GameMasterShopkeepersTableComponent, + PlayerWeaponsTableComponent, + PlayerArmorsTableComponent, + PlayerOtherEquipmentTableComponent, SendMessageActionComponent, SnackbarComponent, MessageDialogComponent, diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-armors-table/player-armors-table.component.css b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-armors-table/player-armors-table.component.css new file mode 100644 index 0000000..db5e93a --- /dev/null +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-armors-table/player-armors-table.component.css @@ -0,0 +1,63 @@ +.text-cut { + max-width: 60px; /* feel free to include any other value */ + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +table { + background-color: initial; +} + +mat-paginator { + background-color: initial; + color: white; +} + +::ng-deep .mat-select-arrow { + color: whitesmoke; +} + +::ng-deep .mat-select-value { + color: white; +} + +.mat-sort-header-container { + color: whitesmoke !important; +} + +.mat-form-field { + font-size: 14px; + width: 100%; +} + +td, +th { + color: whitesmoke; +} + +.text-centre { + padding: 1%; + text-align: center; + align-items: center +} + +th.mat-header-cell { + border-bottom: #e8cca7 + solid 1px; +} + +td.mat-cell { + border-bottom: #e8cca7 + solid 1px; +} + +table.mat-table { + margin-left: 7%; +} + +@media (max-width: 365px) { + table.mat-table { + margin-left: 0%; + } +} diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-armors-table/player-armors-table.component.html b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-armors-table/player-armors-table.component.html new file mode 100644 index 0000000..0708404 --- /dev/null +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-armors-table/player-armors-table.component.html @@ -0,0 +1,41 @@ +
Your armors:
+
+ + Filter + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name {{row.name}} Category {{row.category}} Weight {{row.weight}} Cost {{row.cost}} $
No data matching the filter "{{input.value}}"
+ + +
+
diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-armors-table/player-armors-table.component.spec.ts b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-armors-table/player-armors-table.component.spec.ts new file mode 100644 index 0000000..56b5a1e --- /dev/null +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-armors-table/player-armors-table.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { PlayerArmorsTableComponent } from './player-armors-table.component'; + +describe('PlayerArmorsTableComponent', () => { + let component: PlayerArmorsTableComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ PlayerArmorsTableComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(PlayerArmorsTableComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-armors-table/player-armors-table.component.ts b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-armors-table/player-armors-table.component.ts new file mode 100644 index 0000000..9ebcadc --- /dev/null +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-armors-table/player-armors-table.component.ts @@ -0,0 +1,68 @@ +import { Component, OnInit, ViewChild } from '@angular/core'; +import { MatTableDataSource } from '@angular/material/table'; +import { MatPaginator } from '@angular/material/paginator'; +import { MatSort } from '@angular/material/sort'; +import { ArmorViewModel } from '../../../types/viewmodels/armor-viewmodels/ArmorViewModel'; +import { first } from 'rxjs/operators'; +import { ErrorResponse } from '../../../types/ErrorResponse'; +import { HttpErrorResponse } from '@angular/common/http'; +import { EquipmentService } from '../../../services/equipment.service'; +import { Store } from '@ngrx/store'; +import { AppState } from '../../store/models/app-state.model'; + +@Component({ + selector: 'app-player-armors-table', + templateUrl: './player-armors-table.component.html', + styleUrls: ['./player-armors-table.component.css'] +}) +export class PlayerArmorsTableComponent implements OnInit { + displayedColumns: string[] = [ + 'name', + 'category', + 'weight', + 'cost', + ]; + dataSource: MatTableDataSource; + + @ViewChild(MatPaginator, { static: true }) paginator: MatPaginator; + @ViewChild(MatSort, { static: true }) sort: MatSort; + + constructor(private store: Store, private equipmentService: EquipmentService) {} + + ngOnInit() { + this.getCharacterArmors(); + } + + getCharacterArmors() { + this.store + .select((s) => s.playerStore.characterId) + .pipe(first()) + .subscribe((characterId) => { + this.equipmentService + .getCharacterArmors(characterId) + .pipe(first()) + .subscribe( + (result) => { + this.dataSource = new MatTableDataSource(result); + this.dataSource.paginator = this.paginator; + this.dataSource.sort = this.sort; + }, + (error: ErrorResponse | HttpErrorResponse) => { + if (error instanceof HttpErrorResponse) { + error = error.error as ErrorResponse; + } + console.error(error.message); + } + ); + }); + } + + applyFilter(event: Event) { + const filterValue = (event.target as HTMLInputElement).value; + this.dataSource.filter = filterValue.trim().toLowerCase(); + + if (this.dataSource.paginator) { + this.dataSource.paginator.firstPage(); + } + } +} diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-dashboard/player-dashboard.component.html b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-dashboard/player-dashboard.component.html index d209480..9920974 100644 --- a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-dashboard/player-dashboard.component.html +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-dashboard/player-dashboard.component.html @@ -15,25 +15,37 @@ - + query_stats Statistic and throws - - - local_mall - Equipment + + + + Weapons - + + + Armors + + + + local_mall + Other equipment + + + + - + + shopping_cart diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-dashboard/player-dashboard.component.ts b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-dashboard/player-dashboard.component.ts index fd7c631..2041330 100644 --- a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-dashboard/player-dashboard.component.ts +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-dashboard/player-dashboard.component.ts @@ -4,7 +4,10 @@ import { first } from 'rxjs/operators'; import { Store } from '@ngrx/store'; import { AppState } from 'src/app/store/models/app-state.model'; import { AbilitiesComponent } from '../abilities/abilities.component'; -import { ClearStore, ClearUserId } from '../../store/actions/app.actions'; +import { PlayerWeaponsTableComponent } from '../player-weapons-table/player-weapons-table.component'; +import { PlayerArmorsTableComponent } from '../player-armors-table/player-armors-table.component'; +import { PlayerOtherEquipmentTableComponent } from '../player-other-equipment-table/player-other-equipment-table.component'; +import { ClearStore } from '../../store/actions/app.actions'; import { Router } from '@angular/router'; import { ClearCharacterId } from '../../store/actions/player.action'; import { MatSnackBar } from '@angular/material'; @@ -46,6 +49,16 @@ export class PlayerDashboardComponent implements OnInit { switch (componentName) { case 'AbilitiesComponent': this.middleComponent = AbilitiesComponent; + break; + case 'PlayerWeaponsTableComponent': + this.middleComponent = PlayerWeaponsTableComponent; + break; + case 'PlayerArmorsTableComponent': + this.middleComponent = PlayerArmorsTableComponent; + break; + case 'PlayerOtherEquipmentTableComponent': + this.middleComponent = PlayerOtherEquipmentTableComponent; + break; } } diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-other-equipment-table/player-other-equipment-table.component.css b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-other-equipment-table/player-other-equipment-table.component.css new file mode 100644 index 0000000..43b1669 --- /dev/null +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-other-equipment-table/player-other-equipment-table.component.css @@ -0,0 +1,75 @@ +.text-cut { + max-width: 60px; /* feel free to include any other value */ + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +table { + background-color: initial; +} + +mat-paginator { + background-color: initial; + color: white; +} + +::ng-deep .mat-select-arrow { + color: whitesmoke; +} + +::ng-deep .mat-select-value { + color: white; +} + +.mat-sort-header-container { + color: whitesmoke !important; +} + +.mat-form-field { + font-size: 14px; + width: 100%; +} + +td, +th { + color: whitesmoke; +} + +.text-centre { + padding: 1%; + text-align: center; + align-items: center +} + +th.mat-header-cell { + border-bottom: #e8cca7 + solid 1px; +} + +td.mat-cell { + border-bottom: #e8cca7 + solid 1px; +} + +table.mat-table { + margin-left: 0%; +} + +@media (max-width: 365px) { + table.mat-table { + margin-left: 0%; + } +} + +@media (min-width: 468px) and (max-width: 768px) { + .custom-container { + width: 410px; + } +} + +@media (min-width: 768px) { + .custom-container { + width: 580px; + } +} diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-other-equipment-table/player-other-equipment-table.component.html b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-other-equipment-table/player-other-equipment-table.component.html new file mode 100644 index 0000000..d1e8992 --- /dev/null +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-other-equipment-table/player-other-equipment-table.component.html @@ -0,0 +1,39 @@ +
+
+
Your other equipment:
+ + Filter + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
Name {{row.name}} Cost {{row.cost}} $ Description {{row.description}} +
No data matching the filter "{{input.value}}"
+ + +
+
+
diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-other-equipment-table/player-other-equipment-table.component.spec.ts b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-other-equipment-table/player-other-equipment-table.component.spec.ts new file mode 100644 index 0000000..c809af0 --- /dev/null +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-other-equipment-table/player-other-equipment-table.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { PlayerOtherEquipmentTableComponent } from './player-other-equipment-table.component'; + +describe('PlayerOtherEquipmentTableComponent', () => { + let component: PlayerOtherEquipmentTableComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ PlayerOtherEquipmentTableComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(PlayerOtherEquipmentTableComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-other-equipment-table/player-other-equipment-table.component.ts b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-other-equipment-table/player-other-equipment-table.component.ts new file mode 100644 index 0000000..e40a32b --- /dev/null +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-other-equipment-table/player-other-equipment-table.component.ts @@ -0,0 +1,67 @@ +import { Component, OnInit, ViewChild } from '@angular/core'; +import { MatTableDataSource } from '@angular/material/table'; +import { MatPaginator } from '@angular/material/paginator'; +import { MatSort } from '@angular/material/sort'; +import { OtherEquipmentViewModel} from '../../../types/viewmodels/otherEquipment-viewmodels/OtherEquipmentViewModel'; +import { first } from 'rxjs/operators'; +import { ErrorResponse } from '../../../types/ErrorResponse'; +import { HttpErrorResponse } from '@angular/common/http'; +import { EquipmentService } from '../../../services/equipment.service'; +import { Store } from '@ngrx/store'; +import { AppState } from '../../store/models/app-state.model'; + +@Component({ + selector: 'app-player-other-equipment-table', + templateUrl: './player-other-equipment-table.component.html', + styleUrls: ['./player-other-equipment-table.component.css'] +}) +export class PlayerOtherEquipmentTableComponent implements OnInit { + displayedColumns: string[] = [ + 'name', + 'cost', + 'description', + ]; + dataSource: MatTableDataSource; + + @ViewChild(MatPaginator, { static: true }) paginator: MatPaginator; + @ViewChild(MatSort, { static: true }) sort: MatSort; + + constructor(private store: Store, private equipmentService: EquipmentService) {} + + ngOnInit() { + this.getCharacterOtherEquipment(); + } + + getCharacterOtherEquipment() { + this.store + .select((s) => s.playerStore.characterId) + .pipe(first()) + .subscribe((characterId) => { + this.equipmentService + .getCharacterOtherEquipment(characterId) + .pipe(first()) + .subscribe( + (result) => { + this.dataSource = new MatTableDataSource(result); + this.dataSource.paginator = this.paginator; + this.dataSource.sort = this.sort; + }, + (error: ErrorResponse | HttpErrorResponse) => { + if (error instanceof HttpErrorResponse) { + error = error.error as ErrorResponse; + } + console.error(error.message); + } + ); + }); + } + + applyFilter(event: Event) { + const filterValue = (event.target as HTMLInputElement).value; + this.dataSource.filter = filterValue.trim().toLowerCase(); + + if (this.dataSource.paginator) { + this.dataSource.paginator.firstPage(); + } + } +} diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-weapons-table/player-weapons-table.component.css b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-weapons-table/player-weapons-table.component.css new file mode 100644 index 0000000..b073f89 --- /dev/null +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-weapons-table/player-weapons-table.component.css @@ -0,0 +1,63 @@ +.text-cut { + max-width: 60px; /* feel free to include any other value */ + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +table { + background-color: initial; +} + +mat-paginator { + background-color: initial; + color: white; +} + +::ng-deep .mat-select-arrow { + color: whitesmoke; +} + +::ng-deep .mat-select-value { + color: white; +} + +.mat-sort-header-container { + color: whitesmoke !important; +} + +.mat-form-field { + font-size: 14px; + width: 100%; +} + +td, +th { + color: whitesmoke; +} + +.text-centre { + padding: 1%; + text-align: center; + align-items: center +} + +th.mat-header-cell { + border-bottom: #e8cca7 + solid 1px; +} + +td.mat-cell { + border-bottom: #e8cca7 + solid 1px; +} + +table.mat-table { + margin-left: 10%; +} + +@media (max-width: 365px) { + table.mat-table { + margin-left: 3%; + } +} diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-weapons-table/player-weapons-table.component.html b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-weapons-table/player-weapons-table.component.html new file mode 100644 index 0000000..a813753 --- /dev/null +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-weapons-table/player-weapons-table.component.html @@ -0,0 +1,39 @@ +
Your weapons:
+ + Filter + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name {{row.name}} Weapon Type {{row.weaponType}} Weight {{row.weight}} Cost {{row.cost}} $
No data matching the filter "{{input.value}}"
+ + +
diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-weapons-table/player-weapons-table.component.spec.ts b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-weapons-table/player-weapons-table.component.spec.ts new file mode 100644 index 0000000..d20347a --- /dev/null +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-weapons-table/player-weapons-table.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { PlayerWeaponsTableComponent } from './player-weapons-table.component'; + +describe('PlayerWeaponsTableComponent', () => { + let component: PlayerWeaponsTableComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ PlayerWeaponsTableComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(PlayerWeaponsTableComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-weapons-table/player-weapons-table.component.ts b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-weapons-table/player-weapons-table.component.ts new file mode 100644 index 0000000..89d454a --- /dev/null +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/player-weapons-table/player-weapons-table.component.ts @@ -0,0 +1,69 @@ +import { Component, OnInit, ViewChild } from '@angular/core'; +import { MatTableDataSource } from '@angular/material/table'; +import { MatPaginator } from '@angular/material/paginator'; +import { MatSort } from '@angular/material/sort'; +import { WeaponViewModel } from '../../../types/viewmodels/weapon-viewmodels/WeaponViewModel'; +import { first } from 'rxjs/operators'; +import { ErrorResponse } from '../../../types/ErrorResponse'; +import { HttpErrorResponse } from '@angular/common/http'; +import { EquipmentService } from '../../../services/equipment.service'; +import { Store } from '@ngrx/store'; +import { AppState } from '../../store/models/app-state.model'; + +@Component({ + selector: 'app-player-weapons-table', + templateUrl: './player-weapons-table.component.html', + styleUrls: ['./player-weapons-table.component.css'] +}) +export class PlayerWeaponsTableComponent implements OnInit { + weapons: WeaponViewModel[]; + displayedColumns: string[] = [ + 'name', + 'weaponType', + 'weight', + 'cost', + ]; + dataSource: MatTableDataSource; + + @ViewChild(MatPaginator, { static: true }) paginator: MatPaginator; + @ViewChild(MatSort, { static: true }) sort: MatSort; + + constructor(private store: Store, private equipmentService: EquipmentService) {} + + ngOnInit() { + this.getCharacterWeapons(); + } + + getCharacterWeapons() { + this.store + .select((s) => s.playerStore.characterId) + .pipe(first()) + .subscribe((characterId) => { + this.equipmentService + .getCharacterWeapons(1) + .pipe(first()) + .subscribe( + (result) => { + this.dataSource = new MatTableDataSource(result); + this.dataSource.paginator = this.paginator; + this.dataSource.sort = this.sort; + }, + (error: ErrorResponse | HttpErrorResponse) => { + if (error instanceof HttpErrorResponse) { + error = error.error as ErrorResponse; + } + console.error(error.message); + } + ); + }); + } + + applyFilter(event: Event) { + const filterValue = (event.target as HTMLInputElement).value; + this.dataSource.filter = filterValue.trim().toLowerCase(); + + if (this.dataSource.paginator) { + this.dataSource.paginator.firstPage(); + } + } +} diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/services/equipment.service.ts b/SessionCompanion/SessionCompanion/ClientApp/src/services/equipment.service.ts new file mode 100644 index 0000000..3c8e4b8 --- /dev/null +++ b/SessionCompanion/SessionCompanion/ClientApp/src/services/equipment.service.ts @@ -0,0 +1,60 @@ +import { Inject, Injectable } from '@angular/core'; +import { HttpClient, HttpParams } from '@angular/common/http'; +import { WeaponViewModel } from '../types/viewmodels/weapon-viewmodels/WeaponViewModel'; +import { Observable, of, throwError } from 'rxjs'; +import { Either } from '../types/Either'; +import { ErrorResponse } from '../types/ErrorResponse'; +import { switchMap } from 'rxjs/operators'; +import { ArmorViewModel } from '../types/viewmodels/armor-viewmodels/ArmorViewModel'; +import { OtherEquipmentViewModel } from '../types/viewmodels/otherEquipment-viewmodels/OtherEquipmentViewModel'; + +Injectable({ + providedIn: 'root', +}); + +export class EquipmentService { + private baseUrl = 'api/character/equipment/'; + constructor(private http: HttpClient, @Inject('BASE_URL') baseUrl: string) { + this.baseUrl = baseUrl + this.baseUrl; + } + + getCharacterWeapons(characterId: number): Observable { + const params = new HttpParams().set('characterId', characterId.toString()); + return this.http.get>(this.baseUrl + 'getWeapons', {params}).pipe( + switchMap((response) => { + if (response.isLeft) { + return of(response.left); + } else { + return throwError(response.right); + } + }) + ); + } + + getCharacterArmors(characterId: number): Observable { + const params = new HttpParams().set('characterId', characterId.toString()); + return this.http.get>(this.baseUrl + 'getArmors', {params}).pipe( + switchMap((response) => { + if (response.isLeft) { + return of(response.left); + } else { + return throwError(response.right); + } + }) + ); + } + + getCharacterOtherEquipment(characterId: number): Observable { + const params = new HttpParams().set('characterId', characterId.toString()); + return this.http.get>(this.baseUrl + 'getOtherEquipment', {params}).pipe( + switchMap((response) => { + if (response.isLeft) { + return of(response.left); + } else { + return throwError(response.right); + } + }) + ); + } + +} diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/types/viewmodels/otherEquipment-viewmodels/OtherEquipmentViewModel.ts b/SessionCompanion/SessionCompanion/ClientApp/src/types/viewmodels/otherEquipment-viewmodels/OtherEquipmentViewModel.ts new file mode 100644 index 0000000..93c3308 --- /dev/null +++ b/SessionCompanion/SessionCompanion/ClientApp/src/types/viewmodels/otherEquipment-viewmodels/OtherEquipmentViewModel.ts @@ -0,0 +1,7 @@ +export interface OtherEquipmentViewModel { + id: number; + name: string; + description: string; + const: number; + currencyType: number; +}