Skip to content

Commit

Permalink
fix: 需要判断类型
Browse files Browse the repository at this point in the history
  • Loading branch information
duan602728596 committed Jun 1, 2023
1 parent 5c86771 commit 37f1735
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/qqtools/src/QQ/services/xiaohongshu.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import got, { type Response as GotResponse } from 'got';
import type { _UserPostedObject, _FeedObject } from '@qqtools3/main/src/logProtocol/logTemplate/xiaohongshu';
import { _xiaohongshuLogProtocol } from '../../utils/logProtocol/logActions';
import { XHSProtocol } from '../function/expand/xiaohongshu/xiaohongshu.worker/messageTypes';
import { XHSProtocol, MessageObject, isSignMessage } from '../function/expand/xiaohongshu/xiaohongshu.worker/messageTypes';
import type { UserPostedResponse, NoteFeedResponse, SignResult } from './interface';

export async function requestSign(port: number, reqPath: string, data: any | undefined): Promise<SignResult> {
Expand All @@ -20,8 +20,8 @@ function invokeSign(reqPath: string, data: string | undefined): Promise<SignResu
const id: string = `${ Math.random() }`;

return new Promise((resolve: Function, reject: Function): void => {
function handleSignMessage(event: MessageEvent<{ id: string; result: SignResult }>): void {
if (id === event.data.id) {
function handleSignMessage(event: MessageEvent<MessageObject>): void {
if (isSignMessage(event.data) && id === event.data.id) {
removeEventListener('message', handleSignMessage);
resolve(event.data.result);
}
Expand Down

0 comments on commit 37f1735

Please sign in to comment.