summaryrefslogtreecommitdiff
path: root/src/serve.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/serve.rs')
-rw-r--r--src/serve.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/serve.rs b/src/serve.rs
index ee0e5ff..ab07607 100644
--- a/src/serve.rs
+++ b/src/serve.rs
@@ -5,8 +5,8 @@ use rocket::response::Redirect;
#[get("/callback/<name>/<lobby>/<url>")]
pub async fn get_tracks(name: String, lobby: String, url: String) -> Result<(), Error> {
- let (spotify_uid, spotify_client) = spotify::auth_user(name.as_ref(), url).await?;
- let uid = database::insert_user(spotify_uid.as_ref(), lobby.as_ref())?;
+ let (spotify_uid, spotify_client) = spotify::auth_user(name.as_ref(), url.as_str()).await?;
+ let uid = database::insert_user(spotify_uid.as_ref(), lobby.as_ref()).await?;
spotify::load_profile(uid, spotify_uid.as_ref(), spotify_client).await
}
@@ -16,20 +16,20 @@ pub fn token(name: String) -> Result<Redirect, Error> {
}
#[get("/match/<lobby>/<names>")]
-pub fn match_users(lobby: String, names: String) -> Result<String, Error> {
+pub async fn match_users(lobby: String, names: String) -> Result<String, Error> {
//let bytes = base64::decode_config(names, base64::URL_SAFE).unwrap();
//let names = String::from_utf8(bytes).unwrap();
let names: Vec<&str> = names.split(',').collect();
- database::match_users(lobby, names.as_slice())
+ database::match_users(lobby, names.as_slice()).await
}
#[get("/users/<lobby>")]
-pub fn get_users(lobby: String) -> Result<String, Error> {
- database::get_users(lobby.as_str())
+pub async fn get_users(lobby: String) -> Result<String, Error> {
+ database::get_users(lobby.as_str()).await
}
//#[post("/lobby", format = "application/json", data = "<name>")]
#[post("/lobby/<name>")]
-pub fn create_lobby(name: String) -> Result<String, Error> {
- database::create_lobby(name.as_str())
+pub async fn create_lobby(name: String) -> Result<String, Error> {
+ database::create_lobby(name.as_str()).await
}