Handle api error json (#18)

* Handle api error json

* Fix get vehicles error handling
Update .env.template
This commit is contained in:
John Wu
2021-03-17 15:11:41 -07:00
committed by GitHub
parent 2e1f4a7a7c
commit bf401e68eb
10 changed files with 69 additions and 47 deletions

View File

@@ -24,9 +24,9 @@ const MainForm = () => {
vin: vinEl.current.value,
};
await addVehicle(formData, authToken);
const result = await addVehicle(formData, authToken);
setMessage(`Added ${vinEl.current.value}`);
setMessage(`Added ${result.vin}`);
vinEl.current.value = "";
} catch (e) {
setMessage(e.message);