@droppii-org/chat-sdk 0.0.32 → 0.0.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAuth.d.ts","sourceRoot":"","sources":["../../../src/hooks/user/useAuth.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useAuth.d.ts","sourceRoot":"","sources":["../../../src/hooks/user/useAuth.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,YAAY;;CAoBxB,CAAC"}
|
|
@@ -1,7 +1,21 @@
|
|
|
1
|
+
import { Platform } from "@openim/wasm-client-sdk";
|
|
1
2
|
import { DChatSDK } from "../../constants/sdk";
|
|
3
|
+
import useAuthStore from "../../store/auth";
|
|
4
|
+
import useConversationStore from "../../store/conversation";
|
|
2
5
|
export const useDChatAuth = () => {
|
|
6
|
+
const initAuthStore = useAuthStore((state) => state.initAuthStore);
|
|
7
|
+
const resetConversationStore = useConversationStore((state) => state.resetConversationStore);
|
|
3
8
|
const logout = async () => {
|
|
4
9
|
const res = await DChatSDK.logout();
|
|
10
|
+
resetConversationStore();
|
|
11
|
+
initAuthStore({
|
|
12
|
+
chatToken: "",
|
|
13
|
+
accessToken: "",
|
|
14
|
+
apiAddress: "",
|
|
15
|
+
wsAddress: "",
|
|
16
|
+
platformID: Platform.Web,
|
|
17
|
+
userID: "",
|
|
18
|
+
});
|
|
5
19
|
return res;
|
|
6
20
|
};
|
|
7
21
|
return { logout };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../src/store/conversation.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAO3C,QAAA,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../src/store/conversation.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAO3C,QAAA,MAAM,oBAAoB,gFAkJvB,CAAC;AAEJ,eAAe,oBAAoB,CAAC"}
|
|
@@ -109,5 +109,17 @@ const useConversationStore = create((set, get) => ({
|
|
|
109
109
|
currentMemberInGroup: memberInfo ? Object.assign({}, memberInfo) : undefined,
|
|
110
110
|
}));
|
|
111
111
|
},
|
|
112
|
+
resetConversationStore: () => {
|
|
113
|
+
set({
|
|
114
|
+
conversationData: null,
|
|
115
|
+
selectedConversationId: "",
|
|
116
|
+
selectedSourceId: "",
|
|
117
|
+
conversationList: [],
|
|
118
|
+
currentConversation: undefined,
|
|
119
|
+
unreadCount: 0,
|
|
120
|
+
currentGroupInfo: undefined,
|
|
121
|
+
currentMemberInGroup: undefined,
|
|
122
|
+
});
|
|
123
|
+
},
|
|
112
124
|
}));
|
|
113
125
|
export default useConversationStore;
|