Handle api error json (#18)
* Handle api error json * Fix get vehicles error handling Update .env.template
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { fetchRespHandler } from "../utils/http";
|
||||
|
||||
const AUTH_URL = process.env.REACT_APP_AUTH_SERVICE_URL || "https://gw-dev.fiskerdps.com/compute_auth";
|
||||
const CALLBACK_URL = process.env.REACT_APP_AUTH_CALLBACK_URL || "https://dev-ota-admin.fiskerdps.com";
|
||||
|
||||
@@ -13,7 +15,7 @@ const auth = {
|
||||
code,
|
||||
redirect: CALLBACK_URL,
|
||||
})
|
||||
}).then((response) => response.json()),
|
||||
}).then(fetchRespHandler),
|
||||
|
||||
verify: (idToken) => fetch(`${AUTH_URL}/verify`, {
|
||||
method: "POST",
|
||||
@@ -21,7 +23,7 @@ const auth = {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({ token: idToken })
|
||||
}).then((response) => response.json()),
|
||||
}).then(fetchRespHandler),
|
||||
|
||||
refresh: (refreshToken) => fetch(`${AUTH_URL}/refresh`, {
|
||||
method: "POST",
|
||||
@@ -29,7 +31,7 @@ const auth = {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({ refresh_token: refreshToken })
|
||||
}).then((response) => response.json()),
|
||||
}).then(fetchRespHandler),
|
||||
};
|
||||
|
||||
export default auth;
|
||||
|
||||
Reference in New Issue
Block a user