对接确认订单
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { useDispatch } from 'react-redux'
|
||||
import {SET_COMMON, CLEAR_COMMON} from '@/constants/common'
|
||||
import {useSelector} from '@/reducers/hooks'
|
||||
/**
|
||||
* 这个hook 用来临时存储数据用
|
||||
*/
|
||||
export default () => {
|
||||
const {common: commonData} = useSelector(state => state.commonData)
|
||||
const dispatch = useDispatch()
|
||||
const setCommonData = (val:any) => {
|
||||
dispatch({type:SET_COMMON, data:val})
|
||||
}
|
||||
|
||||
const removeCommonData = () => {
|
||||
dispatch({type:CLEAR_COMMON})
|
||||
}
|
||||
|
||||
return {
|
||||
setCommonData,
|
||||
removeCommonData,
|
||||
commonData
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user