MCPcopy
hub / github.com/yinxin630/fiora / useAction

Function useAction

packages/web/src/hooks/useAction.ts:9–134  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

7 * 获取 redux action
8 */
9export default function useAction() {
10 const dispatch = useDispatch();
11
12 return {
13 setUser(user: User) {
14 dispatch({
15 type: ActionTypes.SetUser,
16 payload: user,
17 });
18 },
19
20 logout() {
21 dispatch({
22 type: ActionTypes.Logout,
23 });
24 },
25
26 setAvatar(avatar: string) {
27 dispatch({
28 type: ActionTypes.SetAvatar,
29 payload: avatar,
30 });
31 },
32
33 setFocus(linkmanId: string) {
34 dispatch({
35 type: ActionTypes.SetFocus,
36 payload: linkmanId,
37 });
38 },
39
40 addLinkman(linkman: Linkman, focus = false) {
41 dispatch({
42 type: ActionTypes.AddLinkman,
43 payload: {
44 linkman,
45 focus,
46 },
47 });
48 },
49
50 removeLinkman(linkmanId: string) {
51 dispatch({
52 type: ActionTypes.RemoveLinkman,
53 payload: linkmanId,
54 });
55 },
56
57 addLinkmanHistoryMessages(linkmanId: string, messages: Message[]) {
58 messages.forEach((message) => convertMessage(message));
59 dispatch({
60 type: ActionTypes.AddLinkmanHistoryMessages,
61 payload: {
62 linkmanId,
63 messages,
64 },
65 });
66 },

Callers 15

InviteInfoFunction · 0.85
GroupInfoFunction · 0.85
UserInfoFunction · 0.85
LoginFunction · 0.85
RegisterFunction · 0.85
LoginAndRegisterFunction · 0.85
CreateGroupFunction · 0.85
LinkmanFunction · 0.85
SettingFunction · 0.85
SelfInfoFunction · 0.85
SidebarFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected