You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
GHHub/src/hooks/useProductsSets.js

47 lines
1.5 KiB
JavaScript

import { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
/**
* 产品管理 相关的预设数据
*/
export const useProductsTypes = () => {
const [types, setTypes] = useState([]);
const { t, i18n } = useTranslation();
useEffect(() => {
const newData = [
{ label: t('products:type.Experience'), value: t('products:type.Experience') },
{label: t("products:type.Car"), value: t("products:type.Car"),},
{label: t("products:type.Guide"), value: t("products:type.Guide"),},
{label: t("products:type.Package"), value: t("products:type.Package"),},
{label: t("products:type.Attractions"), value: t("products:type.Attractions"),},
{label: t("products:type.Meals"), value: t("products:type.Meals"),},
{label: t("products:type.Extras"), value: t("products:type.Extras"),},
{label: t("products:type.Special"), value: t("products:type.Special")},
];
setTypes(newData);
}, [i18n.language]);
return types;
};
export const useProductsAuditStatus = () => {
const [types, setTypes] = useState([]);
const { t, i18n } = useTranslation();
useEffect(() => {
const newData = [
{ value: '0', label: 'New' },
{ value: '1', label: 'Pending' },
{ value: '2', label: 'Approve' },
{ value: '3', label: 'Rejected' },
{ value: '4', label: 'Published' },
];
setTypes(newData);
}, [i18n.language]);
return types;
};