Added required authorization for all API calls. Added template stylesheet.

This commit is contained in:
Patrick Fic
2020-08-19 15:03:55 -07:00
parent ef2e015347
commit 88858e6789
7 changed files with 252 additions and 110 deletions

View File

@@ -18,9 +18,25 @@ import App from "./App";
import { ConfigProvider } from "antd";
import enLocale from "antd/es/locale/en_US";
import moment from "moment";
import axios from "axios";
moment.locale("en-US");
axios.interceptors.request.use(
async (config) => {
if (!config.headers.Authorization) {
const token =
auth.currentUser && (await auth.currentUser.getIdToken(true));
if (token) {
config.headers.Authorization = `Bearer ${token}`;
}
}
return config;
},
(error) => Promise.reject(error)
);
if (process.env.NODE_ENV === "production") LogRocket.init("gvfvfw/bodyshopapp");
const httpLink = new HttpLink({