@kinvolk/headlamp-plugin
Version:
The needed infrastructure for building Headlamp plugins.
32 lines (31 loc) • 1.44 kB
TypeScript
import { PayloadAction } from '@reduxjs/toolkit';
import { Route } from '../lib/router';
export interface RoutesState {
/**
* The routes in the application. Keyed by the route path, value is the route.
*/
routes: {
[path: string]: Route;
};
/**
* The route filters in the application. That is remove routes from routes.
*/
routeFilters: ((route: Route) => Route | null)[];
}
declare const routesSlice: import("@reduxjs/toolkit").Slice<RoutesState, {
/**
* Adds or updates a route in the state.
*/
setRoute(state: import("immer").WritableDraft<RoutesState>, action: PayloadAction<Route>): void;
/**
* Adds a route filter function to the routeFilters array in the state.
*
* The filter functions can be used elsewhere in the application to filter
* routes based on certain conditions.
*/
setRouteFilter(state: import("immer").WritableDraft<RoutesState>, action: PayloadAction<(route: Route) => Route | null>): void;
}, "routes", "routes", import("@reduxjs/toolkit").SliceSelectors<RoutesState>>;
export declare const setRoute: import("@reduxjs/toolkit").ActionCreatorWithPayload<Route, "routes/setRoute">, setRouteFilter: import("@reduxjs/toolkit").ActionCreatorWithPayload<(route: Route) => Route | null, "routes/setRouteFilter">;
export { routesSlice };
declare const _default: import("redux").Reducer<RoutesState>;
export default _default;