mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-11-24 11:56:02 +03:00
* chore(deps): update dependency prettier to v3 * Format --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Nathan Bierema <nbierema@gmail.com>
27 lines
684 B
TypeScript
27 lines
684 B
TypeScript
import { RECONNECT } from '../constants/socketActionTypes';
|
|
import { ConnectionType, StoreAction } from '../actions';
|
|
|
|
export interface ConnectionStateOptions {
|
|
readonly hostname: string;
|
|
readonly port: number;
|
|
readonly secure: boolean;
|
|
}
|
|
export interface ConnectionState {
|
|
readonly options: ConnectionStateOptions;
|
|
readonly type: ConnectionType;
|
|
}
|
|
|
|
export function connection(
|
|
state: ConnectionState = {
|
|
options: { hostname: 'localhost', port: 8000, secure: false },
|
|
type: 'disabled',
|
|
},
|
|
action: StoreAction,
|
|
) {
|
|
if (action.type === RECONNECT) {
|
|
const { type, ...options } = action.options;
|
|
return { ...state, type, options };
|
|
}
|
|
return state;
|
|
}
|