From 117a38f550fa9264d234501d5d2b1d7641505f37 Mon Sep 17 00:00:00 2001 From: Sebastian Di Luzio Date: Wed, 24 Jul 2024 23:12:04 +0200 Subject: [PATCH] feat: allow changing occupation --- .../modules/resource/occupation.controller.ts | 8 +-- frontend/components/ProposeTrade.vue | 4 +- frontend/components/ShowOccupation.vue | 50 +++++++++++++++---- frontend/components/navbar.vue | 4 +- frontend/composables/useHeader.ts | 9 ---- frontend/pages/index.vue | 8 ++- frontend/pages/resources.vue | 6 --- frontend/pages/trades.vue | 4 -- frontend/pages/treaties.vue | 4 -- 9 files changed, 52 insertions(+), 45 deletions(-) delete mode 100644 frontend/composables/useHeader.ts diff --git a/backend/src/modules/resource/occupation.controller.ts b/backend/src/modules/resource/occupation.controller.ts index 15513f0f..36d80c2c 100644 --- a/backend/src/modules/resource/occupation.controller.ts +++ b/backend/src/modules/resource/occupation.controller.ts @@ -1,9 +1,9 @@ import { + Body, Controller, Get, HttpException, HttpStatus, - Param, Put, } from '@nestjs/common'; import { ResourceService } from '@/modules/resource/resource.service'; @@ -21,12 +21,12 @@ export class OccupationController { return occupation; } - @Put(':type') - async upgradeResource(@Param() params: OccupationTypeDto): Promise { + @Put() + async changeOccupation(@Body() body: OccupationTypeDto): Promise { const { id } = await getUser(); try { - await this.resourceService.changeOccupation(id, params.occupation); + await this.resourceService.changeOccupation(id, body.occupation); } catch (e) { throw new HttpException( 'Failed to change occupation: ' + e, diff --git a/frontend/components/ProposeTrade.vue b/frontend/components/ProposeTrade.vue index 91279427..f64311d6 100644 --- a/frontend/components/ProposeTrade.vue +++ b/frontend/components/ProposeTrade.vue @@ -1,5 +1,5 @@ diff --git a/frontend/pages/treaties.vue b/frontend/pages/treaties.vue index c4e1f8ca..8348430d 100644 --- a/frontend/pages/treaties.vue +++ b/frontend/pages/treaties.vue @@ -11,8 +11,4 @@