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: 'Experience', key: 'Experience' },
{ label: t('products:type.Car'), value: 'Car', key: 'Car' },
{ label: t('products:type.Guide'), value: 'Guide', key: 'Guide' },
{ label: t('products:type.Package'), value: 'Package', key: 'Package' },
{ label: t('products:type.Attractions'), value: 'Attractions', key: 'Attractions' },
{ label: t('products:type.Meals'), value: 'Meals', key: 'Meals' },
{ label: t('products:type.Extras'), value: 'Extras', key: 'Extras' },
{ label: t('products:type.Special'), value: 'Special', key: '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;
};