fix: sort fail

test
bigfengyu 5 years ago
parent b72834064d
commit 88a3a7c339

@ -117,7 +117,6 @@ const mapStateToProps = (state: RootState) => ({
})
const mapDispatchToProps = {
replace,
onSortInterfaceList: sortInterfaceList,
deleteInterface,
}
const InterfaceWrap = connect(
@ -132,15 +131,17 @@ interface InterfaceListProps {
mod: Module
repository: Repository
}
function InterfaceList(props: InterfaceListProps, context: any) {
function InterfaceList(props: InterfaceListProps) {
const [open, setOpen] = useState(false)
const dispatch = useDispatch()
const auth = useSelector((state: RootState) => state.auth)
const { repository, itf, itfs = [], mod } = props
const isOwned = repository.owner!.id === auth.id
const isJoined = repository.members!.find((item: any) => item.id === auth.id)
const handleSort = (_: any, sortable: any) => {
const { onSortInterfaceList } = context
onSortInterfaceList(sortable.toArray())
dispatch(sortInterfaceList(sortable.toArray(), mod.id, () => {
/** empty */
}))
}
return (
<article className="InterfaceList">

@ -26,7 +26,6 @@ import {
deleteInterface,
lockInterface,
unlockInterface,
sortInterfaceList
} from '../../actions/interface'
import {
addProperty,
@ -74,7 +73,6 @@ class RepositoryEditor extends Component<any, any> {
onDeleteInterface: PropTypes.func.isRequired,
onLockInterface: PropTypes.func.isRequired,
onUnlockInterface: PropTypes.func.isRequired,
onSortInterfaceList: PropTypes.func.isRequired,
onAddProperty: PropTypes.func.isRequired,
onUpdateProperty: PropTypes.func.isRequired,
onUpdateProperties: PropTypes.func.isRequired,
@ -278,7 +276,6 @@ const mapDispatchToProps = {
onDeleteInterface: deleteInterface,
onLockInterface: lockInterface,
onUnlockInterface: unlockInterface,
onSortInterfaceList: sortInterfaceList,
onAddProperty: addProperty,
onUpdateProperty: updateProperty,
onUpdateProperties: updateProperties,

Loading…
Cancel
Save