Initial Vite Configuration & addition of prettierrc.

This commit is contained in:
Patrick Fic
2024-02-26 09:48:09 -08:00
parent 48a007de3c
commit f190c26311
45 changed files with 10400 additions and 6945 deletions

View File

@@ -13,25 +13,25 @@ import {SentryLink} from "apollo-link-sentry";
//import { store } from "../redux/store";
const httpLink = new HttpLink({
uri: process.env.REACT_APP_GRAPHQL_ENDPOINT,
uri: import.meta.env.VITE_APP_GRAPHQL_ENDPOINT,
});
const wsLink = new WebSocketLink({
uri: process.env.REACT_APP_GRAPHQL_ENDPOINT_WS,
options: {
lazy: true,
reconnect: true,
connectionParams: async () => {
const token = auth.currentUser && (await auth.currentUser.getIdToken());
if (token) {
return {
headers: {
authorization: token ? `Bearer ${token}` : "",
},
};
}
},
uri: import.meta.env.VITE_APP_GRAPHQL_ENDPOINT_WS,
options: {
lazy: true,
reconnect: true,
connectionParams: async () => {
const token = auth.currentUser && (await auth.currentUser.getIdToken());
if (token) {
return {
headers: {
authorization: token ? `Bearer ${token}` : "",
},
};
}
},
},
});
const roundTripLink = new ApolloLink((operation, forward) => {
@@ -144,8 +144,8 @@ const retryLink = new RetryLink({
});
const middlewares = [];
if (process.env.NODE_ENV === "development") {
middlewares.push(apolloLogger);
if (import.meta.env.DEV) {
middlewares.push(apolloLogger);
}
middlewares.push(
@@ -167,22 +167,22 @@ const cache = new InMemoryCache({
});
const client = new ApolloClient({
link: ApolloLink.from(middlewares),
cache,
connectToDevTools: process.env.NODE_ENV !== "production",
defaultOptions: {
watchQuery: {
fetchPolicy: "network-only",
nextFetchPolicy: "network-only",
errorPolicy: "ignore",
},
query: {
fetchPolicy: "network-only",
errorPolicy: "all",
},
mutate: {
errorPolicy: "all",
},
link: ApolloLink.from(middlewares),
cache,
connectToDevTools: import.meta.env.DEV,
defaultOptions: {
watchQuery: {
fetchPolicy: "network-only",
nextFetchPolicy: "network-only",
errorPolicy: "ignore",
},
query: {
fetchPolicy: "network-only",
errorPolicy: "all",
},
mutate: {
errorPolicy: "all",
},
},
});
export default client;