fix(settings): resume DingTalk space registration after login
This commit is contained in:
@@ -12,11 +12,12 @@ const finished = new Set(['success', 'expired', 'failed', 'closed'])
|
||||
interface DingtalkSessionControlProps {
|
||||
autoStart?: boolean
|
||||
hideTrigger?: boolean
|
||||
space?: string
|
||||
onSuccess?: () => void
|
||||
onClose?: () => void
|
||||
}
|
||||
|
||||
export function DingtalkSessionControl({ autoStart = false, hideTrigger = false, onSuccess, onClose }: DingtalkSessionControlProps = {}) {
|
||||
export function DingtalkSessionControl({ autoStart = false, hideTrigger = false, space, onSuccess, onClose }: DingtalkSessionControlProps = {}) {
|
||||
const [session, setSession] = useState<DingtalkSessionView | null>(null)
|
||||
const [failure, setFailure] = useState<string | null>(null)
|
||||
const [starting, setStarting] = useState(false)
|
||||
@@ -51,7 +52,7 @@ export function DingtalkSessionControl({ autoStart = false, hideTrigger = false,
|
||||
setOpen(true); setStarting(true); setFailure(null); setSession(null); setLastSuccess(false)
|
||||
successHandledRef.current = false
|
||||
try {
|
||||
const fresh = await startDingtalkSession()
|
||||
const fresh = await startDingtalkSession(space)
|
||||
idRef.current = fresh.id
|
||||
setSession(fresh)
|
||||
} catch (cause) {
|
||||
@@ -59,7 +60,7 @@ export function DingtalkSessionControl({ autoStart = false, hideTrigger = false,
|
||||
} finally {
|
||||
setStarting(false)
|
||||
}
|
||||
}, [])
|
||||
}, [space])
|
||||
|
||||
useEffect(() => {
|
||||
if (!autoStart || autoStartedRef.current) return
|
||||
|
||||
Reference in New Issue
Block a user