import settings from 'electron-settings' ; import { Dispatch } from 'redux' ; import { JsonObject } from '../../types/JsonValue' ; export const SETTINGS_MAIN_UPDATE = 'SETTINGS_MAIN_UPDATE' ; export async function updateMainSettings ( data ) { for ( const key in data ) { await settings . set ( key , data [ key ] ) ; } return ( dispatch ) => { dispatch ( { type : SETTINGS_MAIN_UPDATE } ) ; } ; } export const SETTINGS_AUTOLAUNCH_ON = 'SETTINGS_AUTOLAUNCH_ON' ; export const SETTINGS_AUTOLAUNCH_OFF = 'SETTINGS_AUTOLAUNCH_OFF' ; export function updateAutolaunchSettings ( data ) { if ( data === 'yes' ) { return ( dispatch ) => { dispatch ( { type : SETTINGS_AUTOLAUNCH_ON } ) ; } ; } return ( dispatch ) => { dispatch ( { type : SETTINGS_AUTOLAUNCH_OFF } ) ; } ; }