mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2026-11-01 09:15:23 +00:00
Fix push device unregistration endpoint (#7891)
This commit is contained in:
1 file changed
+15
-11
+15
-11
@@ -139,21 +139,25 @@ pub async fn unregister_push_device(push_id: Option<&PushId>) -> EmptyResult {
|
|||||||
if !CONFIG.push_enabled() || push_id.is_none() {
|
if !CONFIG.push_enabled() || push_id.is_none() {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
let auth_api_token = get_auth_api_token().await?;
|
let data = json!({
|
||||||
|
"id": push_id.as_ref().unwrap(),
|
||||||
|
});
|
||||||
|
|
||||||
|
let auth_api_token = get_auth_api_token().await?;
|
||||||
let auth_header = format!("Bearer {auth_api_token}");
|
let auth_header = format!("Bearer {auth_api_token}");
|
||||||
|
|
||||||
match make_http_request(
|
if let Err(e) = make_http_request(Method::POST, &(CONFIG.push_relay_uri() + "/push/delete"))?
|
||||||
Method::POST,
|
.header(CONTENT_TYPE, "application/json")
|
||||||
&format!("{}/push/delete/{}", CONFIG.push_relay_uri(), push_id.as_ref().unwrap()),
|
.header(ACCEPT, "application/json")
|
||||||
)?
|
.header(AUTHORIZATION, auth_header)
|
||||||
.header(AUTHORIZATION, auth_header)
|
.json(&data)
|
||||||
.send()
|
.send()
|
||||||
.await
|
.await?
|
||||||
|
.error_for_status()
|
||||||
{
|
{
|
||||||
Ok(r) => r,
|
err!(format!("An error occurred during device unregistration: {e}"));
|
||||||
Err(e) => err!(format!("An error occurred during device unregistration: {e}")),
|
}
|
||||||
};
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user