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,20 +65,24 @@ 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(
if (v === 'none') { (v) => {
onChange(null); if (v === 'none') {
return; onChange(null);
} return;
if (v === 'cron') { }
onChange('0 * * * * *'); if (v === 'cron') {
return; onChange('0 * * * * *');
} 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