M shared/src/api/game/all_forming.rs => shared/src/api/game/all_forming.rs +3 -3
@@ 6,7 6,7 @@
* See LICENSE for licensing information.
*/
-use reqwest;
+use reqwest::{self, header::COOKIE};
use serde::{Deserialize, Serialize};
use crate::{error::api::APIError, types::game::Game};
@@ 20,12 20,12 @@ pub enum ResponseAllForming {
Valid(ResultAllForming),
}
-pub fn all_forming(api_address: String, token: String) -> ResponseAllForming {
+pub fn all_forming(api_address: String, cookie: &String) -> ResponseAllForming {
let client = reqwest::blocking::Client::new();
let resp = client
.get(&format!("{}/game/all_forming", api_address))
- .header("Authorization", token)
+ .header(COOKIE, &format!("id={}", cookie))
.send()
.unwrap();
M shared/src/api/game/create.rs => shared/src/api/game/create.rs +4 -4
@@ 6,7 6,7 @@
* See LICENSE for licensing information.
*/
-use reqwest;
+use reqwest::{self, header::COOKIE};
use serde::{Deserialize, Serialize};
use crate::{error::api::APIError, types::game::Game};
@@ 18,12 18,12 @@ pub enum ResponseCreateGame {
Valid(Game),
}
-pub fn create(api_address: String, token: String) -> ResponseCreateGame {
+pub fn create(api_address: &String, cookie: &String) -> ResponseCreateGame {
let client = reqwest::blocking::Client::new();
let resp = client
- .post(&format!("{}/game/create", api_address))
- .header("Authorization", token)
+ .post(&format!("{}/game", api_address))
+ .header(COOKIE, &format!("id={}", cookie))
.send()
.unwrap();
M shared/src/api/game/mygames.rs => shared/src/api/game/mygames.rs +3 -3
@@ 6,7 6,7 @@
* See LICENSE for licensing information.
*/
-use reqwest;
+use reqwest::{self, header::COOKIE};
use serde::{Deserialize, Serialize};
use crate::{error::api::APIError, types::game::Game};
@@ 20,12 20,12 @@ pub enum ResponseMyGames {
Valid(ResultMyGames),
}
-pub fn my_games(api_address: String, token: String) -> ResponseMyGames {
+pub fn my_games(api_address: String, cookie: &String) -> ResponseMyGames {
let client = reqwest::blocking::Client::new();
let resp = client
.get(&format!("{}/game/my_games", api_address))
- .header("Authorization", token)
+ .header(COOKIE, &format!("id={}", cookie))
.send()
.unwrap();