fixes some misbehaviour
This commit is contained in:
@@ -10,6 +10,7 @@ use crate::api;
|
||||
type AppPool = web::Data<db::Pool>;
|
||||
type PlayerId = web::Path<i32>;
|
||||
type ItemId = web::Json<i32>;
|
||||
type IdList = web::Json<api::IdList>;
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
struct NewGroupLoot {
|
||||
@@ -66,6 +67,12 @@ fn configure_api(config: &mut web::ServiceConfig) {
|
||||
.service(
|
||||
web::resource("/claims")
|
||||
//.route(web::get().to_async(endpoints::player_claims))
|
||||
.route(web::post().to_async(
|
||||
|pool, (player, data): (PlayerId, IdList)|
|
||||
{
|
||||
db_call(pool, Q::ClaimItems(*player, data.clone()))
|
||||
}
|
||||
))
|
||||
.route(web::put().to_async(
|
||||
|pool, (player, data): (PlayerId, ItemId)| {
|
||||
db_call(pool, Q::ClaimItem(*player, *data))
|
||||
@@ -142,7 +149,7 @@ pub fn serve() -> std::io::Result<()> {
|
||||
.configure(configure_api)
|
||||
.wrap(
|
||||
Cors::new()
|
||||
.allowed_origin("http://localhost:8080")
|
||||
.allowed_origin("http://localhost:8088")
|
||||
.allowed_methods(vec!["GET", "POST", "PUT", "DELETE", "OPTIONS"])
|
||||
.max_age(3600),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user