Skip to content

Commit 39321ec

Browse files
committed
[FE] feat: voice channel action 관련한 전역 상태 추가 (#74)
1 parent 3924686 commit 39321ec

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { create } from 'zustand';
2+
import { persist } from 'zustand/middleware';
3+
4+
interface ChannelActionState {
5+
isInVoiceChannel: boolean;
6+
isSharingScreen: boolean;
7+
isVideoOn: boolean;
8+
isMicOn: boolean;
9+
setIsInVoiceChannel: () => void;
10+
setIsSharingScreen: () => void;
11+
setIsVideoOn: () => void;
12+
setIsMicOn: () => void;
13+
}
14+
15+
export const useChannelActionStore = create<ChannelActionState>()(
16+
persist(
17+
(set) => ({
18+
isInVoiceChannel: false,
19+
isSharingScreen: false,
20+
isVideoOn: false,
21+
isMicOn: false,
22+
setIsInVoiceChannel: () => set((state) => ({ isInVoiceChannel: !state.isInVoiceChannel })),
23+
setIsSharingScreen: () => set((state) => ({ isSharingScreen: !state.isSharingScreen })),
24+
setIsVideoOn: () => set((state) => ({ isVideoOn: !state.isVideoOn })),
25+
setIsMicOn: () => set((state) => ({ isMicOn: !state.isMicOn })),
26+
}),
27+
{
28+
name: 'channelAction',
29+
},
30+
),
31+
);

0 commit comments

Comments
 (0)