CEC-1691 Handle 503 errors (#156)

This commit is contained in:
John Wu
2022-05-18 16:02:13 -07:00
committed by GitHub
parent 8fde694801
commit 23111f9c3a
8 changed files with 206 additions and 104 deletions

View File

@@ -1,4 +1,5 @@
import {
errorHandler,
getAuthHeaderOptions,
fetchRespHandler,
addQueryParams,
@@ -14,7 +15,9 @@ const manifestsAPI = {
{ "Content-Type": "application/json" },
getAuthHeaderOptions(token)
),
}).then(fetchRespHandler),
})
.then(fetchRespHandler)
.catch(errorHandler),
getManifest: async (id, token) => {
const u = addQueryParams(`${API_ENDPOINT}/manifest`, { id });
@@ -24,7 +27,9 @@ const manifestsAPI = {
{ "Content-Type": "application/json" },
getAuthHeaderOptions(token)
),
}).then(fetchRespHandler);
})
.then(fetchRespHandler)
.catch(errorHandler);
},
getManifests: async (search, token) => {
@@ -35,7 +40,9 @@ const manifestsAPI = {
{ "Content-Type": "application/json" },
getAuthHeaderOptions(token)
),
}).then(fetchRespHandler);
})
.then(fetchRespHandler)
.catch(errorHandler);
},
createManifest: async (data, token) =>
@@ -46,7 +53,9 @@ const manifestsAPI = {
getAuthHeaderOptions(token)
),
body: JSON.stringify(data),
}).then(fetchRespHandler),
})
.then(fetchRespHandler)
.catch(errorHandler),
createManifestECU: async (data, token) =>
fetch(`${API_ENDPOINT}/manifestecu`, {
@@ -56,7 +65,9 @@ const manifestsAPI = {
getAuthHeaderOptions(token)
),
body: JSON.stringify(data),
}).then(fetchRespHandler),
})
.then(fetchRespHandler)
.catch(errorHandler),
};
export default manifestsAPI;