Split up account update logic.

This commit is contained in:
Mike Cao 2022-09-29 15:15:11 -07:00
parent d4abe51331
commit 5fb1f08df8
3 changed files with 66 additions and 56 deletions

View file

@ -33,7 +33,8 @@ export default function AccountEditForm({ values, onSave, onClose }) {
const [message, setMessage] = useState();
const handleSubmit = async values => {
const { ok, data } = await post('/account', values);
const { user_id } = values;
const { ok, data } = await post(user_id ? `/account/${user_id}` : '/account', values);
if (ok) {
onSave();