Skip to content

Commit

Permalink
Init resources storage on updateting an existent API
Browse files Browse the repository at this point in the history
  • Loading branch information
mgoria committed Nov 3, 2015
1 parent 48ec3d2 commit d37226c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,11 @@ export default class Client {
* @private
*/
_initResourcesStorageForApi(restapiId) {
return this._resources[restapiId] = {};
if (!this._resources.hasOwnProperty(restapiId)) {
this._resources[restapiId] = {};
}

return this._resources[restapiId];
}

/**
Expand All @@ -424,6 +428,8 @@ export default class Client {
* @private
*/
_storeApiResource(restapiId, resource) {
this._initResourcesStorageForApi(restapiId); // assure resources storage is created for this api

return this._resources[restapiId][resource.source.path] = resource;
}

Expand Down

0 comments on commit d37226c

Please sign in to comment.