mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-08 19:23:28 +02:00
Make Axios header application conditional.
This commit is contained in:
parent
703e0a811e
commit
74267228ba
1 changed files with 14 additions and 6 deletions
|
@ -18,12 +18,20 @@ declare module "@vue/runtime-core" {
|
|||
|
||||
Log.info(Log.types.OTHER, "Bootstrapping Axios.");
|
||||
|
||||
// This is a necessary header to be passed to the Metaverse server in order for
|
||||
// it to fail with an HTTP error code instead of succeeding and returning
|
||||
// the error in JSON only.
|
||||
axios.defaults.headers.common = {
|
||||
"x-vircadia-error-handle": "badrequest"
|
||||
};
|
||||
// TODO: This needs to be centralized and not hardcoded.
|
||||
const METAVERSE_URL = "https://metaverse.vircadia.com/live";
|
||||
axios.interceptors.request.use((config) => {
|
||||
// This is a necessary header to be passed to the Metaverse server in order for
|
||||
// it to fail with an HTTP error code instead of succeeding and returning
|
||||
// the error in JSON only.
|
||||
if (config.url?.includes(METAVERSE_URL)) {
|
||||
config.headers["x-vircadia-error-handle"] = "badrequest";
|
||||
}
|
||||
console.info("config", config);
|
||||
return config;
|
||||
}, (error) => {
|
||||
return Promise.reject(error);
|
||||
});
|
||||
|
||||
// Be careful when using SSR for cross-request state pollution
|
||||
// due to creating a Singleton instance here;
|
||||
|
|
Loading…
Reference in a new issue