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,4 @@
import { fetchRespHandler } from "../utils/http";
import { errorHandler, fetchRespHandler } from "../utils/http";
const AUTH_URL = process.env.REACT_APP_AUTH_SERVICE_URL;
const CALLBACK_URL = process.env.REACT_APP_AUTH_CALLBACK_URL;
@@ -16,7 +16,9 @@ const auth = {
code,
redirect: CALLBACK_URL,
}),
}).then(fetchRespHandler),
})
.then(fetchRespHandler)
.catch(errorHandler),
verify: (idToken) =>
fetch(`${AUTH_URL}/verify`, {
@@ -25,7 +27,9 @@ const auth = {
"Content-Type": "application/json",
},
body: JSON.stringify({ token: idToken }),
}).then(fetchRespHandler),
})
.then(fetchRespHandler)
.catch(errorHandler),
refresh: (refreshToken) =>
fetch(`${AUTH_URL}/refresh`, {
@@ -34,7 +38,9 @@ const auth = {
"Content-Type": "application/json",
},
body: JSON.stringify({ refresh_token: refreshToken }),
}).then(fetchRespHandler),
})
.then(fetchRespHandler)
.catch(errorHandler),
};
export default auth;