When a payee/category/security/account is deleted, if the item exists in the corresponding LRU cache it should be removed.
This will require the LruCache object returned by ogLruCacheFactory to have a remove() function, that checks if the item is in the list and if so removes it and re-links it's .newer <=> .older items together.
In the model.destroy(); attach a then() handler to the $http.delete call, eg.
model.destroy = function(payee) {
// Flush the $http cache
model.flush();
return $http.delete(model.path(payee.id)).then(function() {
model.deleteRecent(payee);
};
};
model.deleteRecent = function(payee) {
// Remove the item from the LRU cache (if it exists)
model.recent = lruCache.remove(payee);
// Update the local storage with the new list
$window.localStorage.setItem(LRU_CACHE_STORAGE_KEY, JSON.stringify(lruCache.dump()));
};
When a payee/category/security/account is deleted, if the item exists in the corresponding LRU cache it should be removed.
This will require the LruCache object returned by ogLruCacheFactory to have a remove() function, that checks if the item is in the list and if so removes it and re-links it's .newer <=> .older items together.
In the model.destroy(); attach a then() handler to the $http.delete call, eg.