2020-11-25 23:05:27 +03:00
|
|
|
import Bottle from 'bottlejs';
|
|
|
|
import { ConnectDecorator } from '../../container/types';
|
2021-08-21 18:53:06 +03:00
|
|
|
import { filterDomains, listDomains } from '../reducers/domainsList';
|
2020-11-28 11:58:05 +03:00
|
|
|
import { DomainSelector } from '../DomainSelector';
|
2021-08-20 18:30:07 +03:00
|
|
|
import { ManageDomains } from '../ManageDomains';
|
2021-08-21 18:53:06 +03:00
|
|
|
import { editDomainRedirects } from '../reducers/domainRedirects';
|
2020-11-25 23:05:27 +03:00
|
|
|
|
|
|
|
const provideServices = (bottle: Bottle, connect: ConnectDecorator) => {
|
|
|
|
// Components
|
2020-11-28 11:58:05 +03:00
|
|
|
bottle.serviceFactory('DomainSelector', () => DomainSelector);
|
|
|
|
bottle.decorator('DomainSelector', connect([ 'domainsList' ], [ 'listDomains' ]));
|
2020-11-25 23:05:27 +03:00
|
|
|
|
2021-08-20 18:30:07 +03:00
|
|
|
bottle.serviceFactory('ManageDomains', () => ManageDomains);
|
2021-08-21 18:53:06 +03:00
|
|
|
bottle.decorator('ManageDomains', connect(
|
2021-12-09 15:44:29 +03:00
|
|
|
[ 'domainsList', 'selectedServer' ],
|
2021-08-21 18:53:06 +03:00
|
|
|
[ 'listDomains', 'filterDomains', 'editDomainRedirects' ],
|
|
|
|
));
|
2021-08-20 18:30:07 +03:00
|
|
|
|
2020-11-25 23:05:27 +03:00
|
|
|
// Actions
|
|
|
|
bottle.serviceFactory('listDomains', listDomains, 'buildShlinkApiClient');
|
2021-08-21 18:53:06 +03:00
|
|
|
bottle.serviceFactory('filterDomains', () => filterDomains);
|
|
|
|
bottle.serviceFactory('editDomainRedirects', editDomainRedirects, 'buildShlinkApiClient');
|
2020-11-25 23:05:27 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
export default provideServices;
|