/** @format */
import * as React from 'react';
import AdminSet from './components/adminSet';
import {useAccountList, useAccountSave, AccountSaveProps} from '../../../service/accountList';
const accountAdd: React.FC = props => {
    const [addState, requestAdd] = useAccountSave();
    const {history} = props;
    const [listState, requestList] = useAccountList({
        page_number: 1,
    });
    const handleSubmit = (val: AccountSaveProps) => {
        requestAdd(val).then(error => {
            if (error) return;
            history.push('/home/users/list');
        });
    };
    return <AdminSet onsubmit={handleSubmit} history={history} />;
};
export default accountAdd;
