v0.1
This commit is contained in:
27
src/notify_read.rs
Normal file
27
src/notify_read.rs
Normal file
@ -0,0 +1,27 @@
|
||||
extern crate reqwest;
|
||||
use crate::data_refresh;
|
||||
use crate::url;
|
||||
use serde_json::json;
|
||||
|
||||
pub async fn post_request(time: String) -> String {
|
||||
let token = data_refresh(&"access");
|
||||
let url = url(&"notify_update");
|
||||
|
||||
let post = Some(json!({
|
||||
"seenAt": time.to_string(),
|
||||
}));
|
||||
|
||||
let client = reqwest::Client::new();
|
||||
let res = client
|
||||
.post(url)
|
||||
.json(&post)
|
||||
.header("Authorization", "Bearer ".to_owned() + &token)
|
||||
.send()
|
||||
.await
|
||||
.unwrap()
|
||||
.text()
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
return res;
|
||||
}
|
Reference in New Issue
Block a user