fix(plugin-workflow): fix locale key in storage (#4704)

This commit is contained in:
Junyi 2024-06-19 14:01:02 +08:00 committed by GitHub
parent 2d2f1c8cc8
commit 173dfbfe21
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -7,9 +7,9 @@
* For more information, please refer to: https://www.nocobase.com/agreement. * For more information, please refer to: https://www.nocobase.com/agreement.
*/ */
import { css } from '@nocobase/client'; import { css, useAPIClient } from '@nocobase/client';
import { InputNumber, Select } from 'antd'; import { InputNumber, Select } from 'antd';
import React from 'react'; import React, { useCallback } from 'react';
import { Cron } from 'react-js-cron'; import { Cron } from 'react-js-cron';
import { useWorkflowTranslation } from '../../locale'; import { useWorkflowTranslation } from '../../locale';
import CronZhCN from './locale/Cron.zh-CN'; import CronZhCN from './locale/Cron.zh-CN';
@ -65,8 +65,10 @@ function CommonRepeatField({ value, onChange }) {
export function RepeatField({ value = null, onChange }) { export function RepeatField({ value = null, onChange }) {
const { t } = useWorkflowTranslation(); const { t } = useWorkflowTranslation();
const api = useAPIClient();
const typeValue = getRepeatTypeValue(value); const typeValue = getRepeatTypeValue(value);
function onTypeChange(v) { const onTypeChange = useCallback(
(v) => {
if (v === 'none') { if (v === 'none') {
onChange(null); onChange(null);
return; return;
@ -76,9 +78,11 @@ export function RepeatField({ value = null, onChange }) {
return; return;
} }
onChange(v); onChange(v);
} },
[onChange],
);
const locale = languages[localStorage.getItem('NOCOBASE_LOCALE') || 'en-US']; const locale = languages[localStorage.getItem(api.auth.locale) || 'en-US'];
return ( return (
<fieldset <fieldset