-
-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reolink add nvr flag #1620
Reolink add nvr flag #1620
Conversation
const deviceInfo: DevInfo = await response.body?.[0]?.value?.DevInfo; | ||
|
||
// Will need to check if it's valid for NVR and NVR_WIFI | ||
if (['HOMEHUB'].includes(deviceInfo.exactType)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
invert this logic so if it doesn't include, it immediately returns deviceInfo. Remaining code will be only for reolink home hub logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
plugins/reolink/src/reolink-api.ts
Outdated
@@ -201,16 +201,53 @@ export class ReolinkCameraClient { | |||
const url = new URL(`http://${this.host}/api.cgi`); | |||
const params = url.searchParams; | |||
params.set('cmd', 'GetDevInfo'); | |||
const response = await this.requestWithLogin({ | |||
let response = await this.requestWithLogin({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are these "let" and reused?
Use different variables for different request types. mutability on the response makes understanding this code later difficult.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
No description provided.