File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,14 @@ use axum::{
10
10
} ;
11
11
use hyper:: { Body , Request } ;
12
12
use primitives:: { campaign:: Campaign , CampaignId , ChainOf } ;
13
+ use serde:: Deserialize ;
14
+
15
+ /// This struct is required because of routes that have more parameters
16
+ /// apart from the `CampaignId`
17
+ #[ derive( Debug , Deserialize ) ]
18
+ struct CampaignParam {
19
+ pub id : CampaignId ,
20
+ }
13
21
14
22
#[ derive( Debug ) ]
15
23
pub struct CampaignLoad ;
80
88
let mut request_parts = RequestParts :: new ( request) ;
81
89
82
90
let campaign_id = request_parts
83
- . extract :: < Path < CampaignId > > ( )
91
+ . extract :: < Path < CampaignParam > > ( )
84
92
. await
85
- . map_err ( |_| ResponseError :: BadRequest ( "Bad Campaign Id" . to_string ( ) ) ) ?;
93
+ . map_err ( |_| ResponseError :: BadRequest ( "Bad Campaign Id" . to_string ( ) ) ) ?
94
+ . id ;
86
95
87
96
let campaign = fetch_campaign ( pool. clone ( ) , & campaign_id)
88
97
. await ?
You can’t perform that action at this time.
0 commit comments