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

@@ -7,6 +7,7 @@ import AsideMenu from '../AsideMenu';
import ErrorHandler from '../ErrorHandler';
import ShlinkVersions from '../ShlinkVersions';
import { ConnectDecorator } from '../../container/types';
import { withoutSelectedServer } from '../../servers/helpers/withoutSelectedServer';
const provideServices = (bottle: Bottle, connect: ConnectDecorator, withRouter: Decorator) => {
bottle.constant('window', (global as any).window);
@@ -19,6 +20,7 @@ const provideServices = (bottle: Bottle, connect: ConnectDecorator, withRouter:
bottle.decorator('MainHeader', withRouter);
bottle.serviceFactory('Home', () => Home);
bottle.decorator('Home', withoutSelectedServer);
bottle.decorator('Home', connect([ 'servers' ], [ 'resetSelectedServer' ]));
bottle.serviceFactory(