CEC-775 Manifest details component (#114)
* CEC-775 Manifest details component * Code smells * Fix build warning
This commit is contained in:
@@ -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,
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user