connection-info.ts (649B)
1 export type ConnectionInfo = { 2 hostname: string | null; 3 password: string | null; 4 ssl: boolean; 5 filterBuffers: boolean; 6 }; 7 8 const initialState: ConnectionInfo = { 9 hostname: null, 10 password: null, 11 ssl: true, 12 filterBuffers: true 13 }; 14 15 export default (state: ConnectionInfo = initialState, action): ConnectionInfo => { 16 switch (action.type) { 17 case "SET_CONNECTION_INFO": 18 return { 19 hostname: action.hostname, 20 password: action.password, 21 ssl: action.ssl, 22 filterBuffers: action.filterBuffers 23 }; 24 case "CLEAR_CONNECTION_INFO": 25 return initialState; 26 default: 27 return state; 28 } 29 };