mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-09 00:56:37 +08:00
fix(frontend): 解决添加DNS账号时this.post is not a function报错
在 DnsAccountCreateDialog 组件中,mutationFn 错误地直接传递了类静态方法 DnsAccountService.create,导致执行时丢失 class constructor 上下文。现将其修改为使用箭头函数包裹,以保证 this 指向正确。
This commit is contained in:
@@ -20,6 +20,7 @@ sidebar: false
|
|||||||
|
|
||||||
### 修复
|
### 修复
|
||||||
|
|
||||||
|
- 修复添加 DNS 账号时因直接传递 class static 方法作为 React Query 的 mutationFn 导致 JavaScript 丢失 `this` 上下文报错 `this.post is not a function` 的问题。
|
||||||
- 修复侧边栏一级菜单项当前页面字体颜色被硬编码为 `#6366F1` 的问题,改用 CSS 主题变量 `text-sidebar-primary`,以保证在多主题系统下的色彩一致性。
|
- 修复侧边栏一级菜单项当前页面字体颜色被硬编码为 `#6366F1` 的问题,改用 CSS 主题变量 `text-sidebar-primary`,以保证在多主题系统下的色彩一致性。
|
||||||
- 修复默认(Default)主题因遗漏声明 `destructive-foreground` 变量,导致删除按钮(如确认删除证书弹窗)在某些状态下渲染为黑底黑字而无法阅读的问题。
|
- 修复默认(Default)主题因遗漏声明 `destructive-foreground` 变量,导致删除按钮(如确认删除证书弹窗)在某些状态下渲染为黑底黑字而无法阅读的问题。
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import {Input} from '@/components/ui/input';
|
|||||||
import {Label} from '@/components/ui/label';
|
import {Label} from '@/components/ui/label';
|
||||||
import {Select, SelectContent, SelectItem, SelectTrigger, SelectValue,} from '@/components/ui/select';
|
import {Select, SelectContent, SelectItem, SelectTrigger, SelectValue,} from '@/components/ui/select';
|
||||||
import {DnsAccountService} from '@/lib/services/openflare';
|
import {DnsAccountService} from '@/lib/services/openflare';
|
||||||
|
import type {DnsAccountMutationPayload} from '@/lib/services/openflare';
|
||||||
|
|
||||||
import {getErrorMessage} from './website-utils';
|
import {getErrorMessage} from './website-utils';
|
||||||
|
|
||||||
@@ -52,7 +53,7 @@ export function DnsAccountCreateDialog({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const createMutation = useMutation({
|
const createMutation = useMutation({
|
||||||
mutationFn: DnsAccountService.create,
|
mutationFn: (payload: DnsAccountMutationPayload) => DnsAccountService.create(payload),
|
||||||
onSuccess: async () => {
|
onSuccess: async () => {
|
||||||
await queryClient.invalidateQueries({queryKey: dnsAccountsQueryKey});
|
await queryClient.invalidateQueries({queryKey: dnsAccountsQueryKey});
|
||||||
form.reset();
|
form.reset();
|
||||||
|
|||||||
Reference in New Issue
Block a user