fix: select invited family device after join
This commit is contained in:
@@ -3,6 +3,8 @@ import Taro, { useDidShow, useRouter } from '@tarojs/taro'
|
||||
import { useState } from 'react'
|
||||
|
||||
import { getToken } from '@/services/auth'
|
||||
import { setSelectedBindingDeviceId } from '@/services/binding'
|
||||
import { setSelectedChildId } from '@/services/child'
|
||||
import { acceptFamilyInvitation, FamilyInvitation, getFamilyInvitation } from '@/services/family'
|
||||
import './index.scss'
|
||||
|
||||
@@ -49,7 +51,11 @@ export default function FamilyInvite() {
|
||||
|
||||
setJoining(true)
|
||||
try {
|
||||
await acceptFamilyInvitation(inviteToken)
|
||||
const result = await acceptFamilyInvitation(inviteToken)
|
||||
setSelectedBindingDeviceId(result.device_id)
|
||||
if (result.child_id) {
|
||||
setSelectedChildId(result.child_id)
|
||||
}
|
||||
Taro.showToast({ title: '已加入家庭', icon: 'success' })
|
||||
setTimeout(() => {
|
||||
Taro.switchTab({ url: '/pages/device/index' })
|
||||
|
||||
Reference in New Issue
Block a user