Use angular cache when querying getMusicFolders and getIndexes
It saves us a few requests and helps making Jamstash faster. It's unlikely that the artists list or the music folders will change during a Jamstash session. It's also an easy cache to reset: the user only has to reload the page.
This commit is contained in:
parent
9c8c8cf6a8
commit
d2bdb8eed9
1 changed files with 4 additions and 2 deletions
|
@ -110,8 +110,9 @@ angular.module('jamstash.subsonic.service', [
|
|||
|
||||
getMusicFolders: function () {
|
||||
var exception = { reason: 'No music folder found on the Subsonic server.' };
|
||||
var promise = subsonicService.subsonicRequest('getMusicFolders.view')
|
||||
.then(function (subsonicResponse) {
|
||||
var promise = subsonicService.subsonicRequest('getMusicFolders.view', {
|
||||
cache: true
|
||||
}).then(function (subsonicResponse) {
|
||||
if (subsonicResponse.musicFolders !== undefined && subsonicResponse.musicFolders.musicFolder !== undefined) {
|
||||
return [].concat(subsonicResponse.musicFolders.musicFolder);
|
||||
} else {
|
||||
|
@ -130,6 +131,7 @@ angular.module('jamstash.subsonic.service', [
|
|||
};
|
||||
}
|
||||
var promise = subsonicService.subsonicRequest('getIndexes.view', {
|
||||
cache: true,
|
||||
params: params
|
||||
}).then(function (subsonicResponse) {
|
||||
if (subsonicResponse.indexes !== undefined && (subsonicResponse.indexes.index !== undefined || subsonicResponse.indexes.shortcut !== undefined)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue