Skip to content

Commit

Permalink
added cached flag for vehicle status
Browse files Browse the repository at this point in the history
  • Loading branch information
mihaiblaga89 committed Dec 27, 2019
1 parent cdad75f commit ea0bcd9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/js/docma-web.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"commitMessageSuffix": "(ignore)",
"major": {
"automerge": false
}
},
"schedule": "before 3am on Monday"
}
2 changes: 1 addition & 1 deletion src/models/vehicle.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class Vehicle {
* const ctatus = await Vehicle.getStatus();
*/
async getStatus(force) {
if (this.status && !force) return this.status;
if (this.status && !force) return { ...this.status, cached: true };
const { vehicleStatus } = await this.API.requestWithAuth(this.BMWURLs.getVehicleStatusURL(this.vin));
this.status = VehicleStatus(vehicleStatus);
return this.status;
Expand Down
2 changes: 2 additions & 0 deletions src/models/vehicleStatus.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const vehicleStatus = (status = {}) => {
* @property {String} digitalChargingServiceActivation Status of the Digital Charging Services
* @property {String} digitalChargingServiceOngoing Status of the Digital Charging Services
* @property {Array<CBSData>} conditionBasedServicingData CBS Data
* @property {Boolean} cached Whether or not the data returned is from cache or not
*/
return {
digitalChargingServiceActivation: status.DCS_CCH_Activation,
Expand Down Expand Up @@ -73,6 +74,7 @@ const vehicleStatus = (status = {}) => {
windowDriverRear: status.windowDriverRear,
windowPassengerFront: status.windowPassengerFront,
windowPassengerRear: status.windowPassengerRear,
cached: false,
};
};

Expand Down

0 comments on commit ea0bcd9

Please sign in to comment.