fixes Vue reactivity problems, updates REST Api endpoints

This commit is contained in:
2019-07-05 14:18:12 +02:00
parent 5f0e6624e0
commit b4692a7a4e
3 changed files with 21 additions and 14 deletions

View File

@@ -64,29 +64,29 @@ pub(crate) fn serve() -> std::io::Result<()> {
.max_age(3600)
)
.route(
"/players",
"/api/players",
web::get().to_async(move |pool: AppPool| {
db_call(pool, move |api| api.fetch_players())
}),
)
.route(
"/claims",
"/api/claims",
web::get().to_async(move |pool: AppPool| db_call(pool, move |api| api.fetch_claims())),
)
.route(
"/update-wealth/{player_id}/{amount}",
"/api/{player_id}/update-wealth/{amount}",
web::get().to_async(move |pool: AppPool, data: web::Path<(i32, f32)>| {
db_call(pool, move |api| api.as_player(data.0).update_wealth(data.1))
}),
)
.route(
"/loot/{player_id}",
"/api/{player_id}/loot",
web::get().to_async(move |pool: AppPool, player_id: web::Path<i32>| {
db_call(pool, move |api| api.as_player(*player_id).loot())
}),
)
.route(
"/admin/add-player/{name}/{wealth}",
"/api/admin/add-player/{name}/{wealth}",
web::get().to_async(move |pool: AppPool, data: web::Path<(String, f32)>| {
db_call(pool, move |api| api.as_admin().add_player(data.0.clone(), data.1))
}),