session-desktop/ts/state/ducks/userConfig.tsx

28 lines
709 B
TypeScript
Raw Normal View History

/**
* This slice is intended for the user configurable settings for the client such as appearance, autoplaying of links etc.
* Anything setting under the cog wheel tab.
*/
2021-07-06 06:40:45 +02:00
import { createSlice } from '@reduxjs/toolkit';
export interface UserConfigState {
audioAutoplay: boolean;
}
export const initialUserConfigState = {
2021-06-24 06:13:45 +02:00
audioAutoplay: false,
};
const userConfigSlice = createSlice({
name: 'userConfig',
initialState: initialUserConfigState,
reducers: {
2021-06-24 06:13:45 +02:00
toggleAudioAutoplay: state => {
state.audioAutoplay = !state.audioAutoplay;
},
},
2021-06-24 06:13:45 +02:00
});
const { actions, reducer } = userConfigSlice;
2021-06-25 01:47:54 +02:00
export const { toggleAudioAutoplay } = actions;
2021-06-24 06:13:45 +02:00
export const userConfigReducer = reducer;