Commit d5af68b7 by panjiangyi

token接入

parent f5dd8918
Showing with 3 additions and 19 deletions
...@@ -31,14 +31,6 @@ export type TokenStringGetter = () => Promise<string> ...@@ -31,14 +31,6 @@ export type TokenStringGetter = () => Promise<string>
export interface ChatOption { export interface ChatOption {
/** /**
* 企业token [商户端使用,用户端和移动端不需要]
*/
enterpriseTokenString?: TokenStringGetter;
/**
* 个人token
*/
userTokenString: TokenStringGetter;
/**
* 长链接chat sdk地址 * 长链接chat sdk地址
*/ */
webSocketUri: string; webSocketUri: string;
...@@ -46,8 +38,6 @@ export interface ChatOption { ...@@ -46,8 +38,6 @@ export interface ChatOption {
sdk: () => UniplatSdk; sdk: () => UniplatSdk;
orgId: () => string | number; orgId: () => string | number;
logger?: ChatServiceLogger;
} }
export interface ChatServiceLogger { export interface ChatServiceLogger {
......
...@@ -21,9 +21,7 @@ class Chat { ...@@ -21,9 +21,7 @@ class Chat {
if (!option) { if (!option) {
throw new Error(`You must specify a chat option for chat service`); throw new Error(`You must specify a chat option for chat service`);
} }
// if (!option.userTokenString) {
// throw new Error(`You must specify a user token for chat service`)
// }
if (!option.webSocketUri) { if (!option.webSocketUri) {
throw new Error( throw new Error(
`You must specify a web socket address for chat service` `You must specify a web socket address for chat service`
...@@ -32,12 +30,8 @@ class Chat { ...@@ -32,12 +30,8 @@ class Chat {
this._sdk = option.sdk; this._sdk = option.sdk;
this._orgId = option.orgId; this._orgId = option.orgId;
// if (option.enterpriseTokenString) { this.token = async () => option.sdk().global.jwtToken;
// this.token = option.enterpriseTokenString
// } else {
this.token = option.userTokenString;
tokenManager.save(this.token); tokenManager.save(this.token);
// }
EmojiService.raiseOnReady(this.token); EmojiService.raiseOnReady(this.token);
return this.initChatSdk(option.webSocketUri); return this.initChatSdk(option.webSocketUri);
......
...@@ -146,7 +146,7 @@ export class Xim { ...@@ -146,7 +146,7 @@ export class Xim {
): Promise<Message[]> { ): Promise<Message[]> {
this.checkConnected(); this.checkConnected();
if (this.client == null) { if (this.client == null) {
throw new Error("client shouldn't undefined") throw new Error("client shouldn't undefined");
}; };
const res = await this.client.fetchChatMsgs(chatType, chatId, { const res = await this.client.fetchChatMsgs(chatType, chatId, {
lid, lid,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment