Add updates by car screen and modal popup (#29)

This commit is contained in:
John Wu
2021-04-06 19:43:49 -07:00
committed by GitHub
parent 09ebbe96e0
commit 1f9db5454f
12 changed files with 401 additions and 113 deletions

View File

@@ -81,6 +81,21 @@ export const UpdatesProvider = ({ children }) => {
return result;
};
const getVINUpdates = async (vin, token) => {
let result;
try {
setBusy(true);
result = await api.getVINUpdates(vin, token);
if (result.error)
throw new Error(`Get VIN updates error. ${result.message}`);
} finally {
setBusy(false);
}
return result;
};
return (
<UpdatesContext.Provider
value={{
@@ -93,6 +108,7 @@ export const UpdatesProvider = ({ children }) => {
updatePackage,
createCarUpdates,
getCarUpdates,
getVINUpdates,
}}
>
{children}