Working supabase structure
This commit is contained in:
@@ -9,17 +9,17 @@ logger!(LOGGER "Auth");
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct AuthApiRes {
|
||||
user_id: u32,
|
||||
user_id: String,
|
||||
}
|
||||
|
||||
pub fn auth(_server: &Arc<Server>, client: &mut Client, token: &str) -> crate::Result<u32> {
|
||||
pub fn auth(_server: &Arc<Server>, client: &mut Client, token: &str) -> crate::Result<String> {
|
||||
let mut res = ureq::get(format!(
|
||||
"http://localhost:3000/api/auth?intents=server&token={token}"
|
||||
))
|
||||
.call()
|
||||
.context("Failed to authenticate")?;
|
||||
let api_res: AuthApiRes = serde_json::from_str(&res.body_mut().read_to_string()?)?;
|
||||
client.set_uuid(api_res.user_id);
|
||||
client.set_uuid(&api_res.user_id);
|
||||
LOGGER.info(format!("{} successfully authenticated", api_res.user_id));
|
||||
Ok(api_res.user_id)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user