Skip to content

Commit 95e5591

Browse files
committed
perf: "修改账户信息成功后关闭 Dialog "
1 parent c4386d7 commit 95e5591

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/components/account/EditDialog.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export const EditDialog: FC<EditDialogProps> = ({ isOpen, onClose }) => {
5151
<span className="ml-1">账户信息</span>
5252
</div>
5353
}
54-
panel={<InfoPanel />}
54+
panel={<InfoPanel onClose={onClose} />}
5555
/>
5656
<Tab
5757
id="password"
@@ -61,7 +61,7 @@ export const EditDialog: FC<EditDialogProps> = ({ isOpen, onClose }) => {
6161
<span className="ml-1">密码</span>
6262
</div>
6363
}
64-
panel={<PasswordPanel />}
64+
panel={<PasswordPanel onClose={onClose} />}
6565
/>
6666
</Tabs>
6767
</GlobalErrorBoundary>
@@ -70,7 +70,7 @@ export const EditDialog: FC<EditDialogProps> = ({ isOpen, onClose }) => {
7070
)
7171
}
7272

73-
const InfoPanel = () => {
73+
const InfoPanel = ({ onClose }) => {
7474
interface FormValues {
7575
username: string
7676
}
@@ -109,6 +109,7 @@ const InfoPanel = () => {
109109
intent: 'success',
110110
message: `更新成功`,
111111
})
112+
onClose(false)
112113
} catch (e) {
113114
console.warn(e)
114115
setError('global' as any, { message: formatError(e) })
@@ -149,7 +150,7 @@ const InfoPanel = () => {
149150
)
150151
}
151152

152-
const PasswordPanel = () => {
153+
const PasswordPanel = ({ onClose }) => {
153154
interface FormValues {
154155
original: string
155156
newPassword: string
@@ -182,6 +183,7 @@ const PasswordPanel = () => {
182183
intent: 'success',
183184
message: `更新成功`,
184185
})
186+
onClose(false)
185187
} catch (e) {
186188
console.warn(e)
187189
setError('global' as any, { message: formatError(e) })

0 commit comments

Comments
 (0)