You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
847 B

  1. /* eslint react/prop-types: 0 */
  2. import React, { createContext, Suspense } from "react";
  3. import { BrowserRouter as Router } from "react-router-dom";
  4. import Loader from "./components/loader";
  5. export const AppContext = createContext();
  6. const AppContextProvider = ({ children }) => {
  7. const defaultState = {
  8. urlServer: process.env.REACT_APP_SERVER_URL,
  9. feedbackForm: process.env.REACT_APP_FEEDBACK_FORM,
  10. routesServer: {
  11. setElection: "election/",
  12. getElection: "election/get/:slug/",
  13. getResultsElection: "election/results/:slug",
  14. voteElection: "election/vote/"
  15. }
  16. };
  17. return (
  18. <Suspense fallback={<Loader />}>
  19. <Router>
  20. <AppContext.Provider value={defaultState}>
  21. {children}
  22. </AppContext.Provider>
  23. </Router>
  24. </Suspense>
  25. );
  26. };
  27. export default AppContextProvider;