mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-23 09:30:31 +03:00
Added lazy loading to action services
This commit is contained in:
parent
12ddeebedf
commit
7bd4b39b5a
1 changed files with 6 additions and 5 deletions
|
@ -45,7 +45,8 @@ const bottle = new Bottle();
|
|||
const { container } = bottle;
|
||||
|
||||
const mapActionService = (map, actionName) => {
|
||||
map[actionName] = container[actionName];
|
||||
// Wrap actual action service in a function so that it is lazily created the first time it is called
|
||||
map[actionName] = (...args) => container[actionName](...args);
|
||||
|
||||
return map;
|
||||
};
|
||||
|
@ -137,14 +138,14 @@ bottle.decorator('DeleteShortUrlModal', connectDecorator(
|
|||
{ deleteShortUrl, resetDeleteShortUrl, shortUrlDeleted }
|
||||
));
|
||||
|
||||
bottle.serviceFactory('editShortUrlTags', editShortUrlTags, 'ShlinkApiClient');
|
||||
bottle.serviceFactory('resetShortUrlsTags', () => resetShortUrlsTags);
|
||||
bottle.serviceFactory('shortUrlTagsEdited', () => shortUrlTagsEdited);
|
||||
|
||||
bottle.serviceFactory('EditTagsModal', EditTagsModal, 'TagsSelector');
|
||||
bottle.decorator('EditTagsModal', connectDecorator(
|
||||
[ 'shortUrlTags' ],
|
||||
[ 'editShortUrlTags', 'resetShortUrlsTags', 'shortUrlTagsEdited' ]
|
||||
));
|
||||
|
||||
bottle.serviceFactory('editShortUrlTags', editShortUrlTags, 'ShlinkApiClient');
|
||||
bottle.serviceFactory('resetShortUrlsTags', () => resetShortUrlsTags);
|
||||
bottle.serviceFactory('shortUrlTagsEdited', () => shortUrlTagsEdited);
|
||||
|
||||
export default container;
|
||||
|
|
Loading…
Reference in a new issue