CEC-775 Manifest details component (#114)

* CEC-775 Manifest details component

* Code smells

* Fix build warning
This commit is contained in:
John Wu
2022-01-17 08:59:55 -08:00
committed by GitHub
parent cb5035cf96
commit a858b842c6
9 changed files with 467 additions and 6 deletions

View File

@@ -9,6 +9,21 @@ export const ManifestsProvider = ({ children }) => {
const [manifests, setManifests] = useState([]);
const [totalManifests, setTotalManifests] = useState(0);
const getManifest = async (id, token) => {
let result;
try {
setBusy(true);
result = await api.getManifest(id, token);
if (result.error)
throw new Error(`Get manifests error. ${result.message}`);
} finally {
setBusy(false);
}
return result;
};
const getManifests = async (search, token) => {
let result;
@@ -54,6 +69,7 @@ export const ManifestsProvider = ({ children }) => {
busy,
manifests,
totalManifests,
getManifest,
getManifests,
deleteManifest,
}}