Skip to content

Commit 08209d1

Browse files
committed
Fix: use consistent parameter name for devices' name
1 parent f98cbdf commit 08209d1

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,4 @@ Some routes (such as `get-hourly-usage`) require timestamps. These must be provi
9292

9393
Once connected to a Tapo device, a session is maintained between the server and the device. But Tapo devices set an expiration time, which means the session will eventually expire.
9494

95-
If this happens, you can hit the `/refresh-session?device_name=...` route to refresh the session.
95+
If this happens, you can hit the `/refresh-session?device=...` route to refresh the session.

src/server/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,21 +98,21 @@ pub async fn serve(
9898

9999
#[derive(Deserialize)]
100100
struct RefreshDeviceSessionParams {
101-
device_name: String,
101+
device: String,
102102
}
103103

104104
async fn refresh_session(
105105
State(state): State<SharedState>,
106106
Query(params): Query<RefreshDeviceSessionParams>,
107107
) -> ApiResult<()> {
108-
let RefreshDeviceSessionParams { device_name } = params;
108+
let RefreshDeviceSessionParams { device } = params;
109109

110110
let mut state = state.write().await;
111111

112112
let device = state
113113
.devices
114-
.get_mut(&device_name)
115-
.with_context(|| format!("Unkown device: {device_name}"))?;
114+
.get_mut(&device)
115+
.with_context(|| format!("Unkown device: {device}"))?;
116116

117117
device
118118
.refresh_session()

0 commit comments

Comments
 (0)