Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
mergeMap(({ payload: { serverId } }) => {
const oldServer = state$.value.entities.serversById[serverId];
if (!oldServer)
return of(
actions.killServerFailed({
serverId,
error: `server with id ${serverId} does not exist in store.`
})
);
const { config } = oldServer.server;
return shutdown(config).pipe(
mergeMap(() => of(actions.killServerFulfilled({ serverId }))),
catchError(error => of(actions.killServerFailed({ serverId, error })))
);
})
);