Created component decorator that resets selected server and used it on Settings

This commit is contained in:
Alejandro Celaya
2020-09-06 13:10:30 +02:00
parent 98d856700c
commit 1b1a1f3230
6 changed files with 26 additions and 14 deletions

View File

@@ -3,10 +3,13 @@ import RealTimeUpdates from '../RealTimeUpdates';
import Settings from '../Settings';
import { setRealTimeUpdates } from '../reducers/settings';
import { ConnectDecorator } from '../../container/types';
import { withoutSelectedServer } from '../../servers/helpers/withoutSelectedServer';
const provideServices = (bottle: Bottle, connect: ConnectDecorator) => {
// Components
bottle.serviceFactory('Settings', Settings, 'RealTimeUpdates');
bottle.decorator('Settings', withoutSelectedServer);
bottle.decorator('Settings', connect(null, [ 'resetSelectedServer' ]));
// Services
bottle.serviceFactory('RealTimeUpdates', () => RealTimeUpdates);