saleor-dashboard/src/auth/AuthProvider.tsx

26 lines
699 B
TypeScript
Raw Normal View History

import { useApolloClient } from "@apollo/client";
2019-10-25 12:35:48 +00:00
import useNotifier from "@saleor/hooks/useNotifier";
import React from "react";
2021-01-26 22:04:54 +00:00
import { useIntl } from "react-intl";
import { UserContext } from "./";
2021-01-26 22:04:54 +00:00
import { useAuthProvider } from "./hooks/useAuthProvider";
2020-07-20 10:12:14 +00:00
interface AuthProviderProps {
children: React.ReactNode;
}
const AuthProvider: React.FC<AuthProviderProps> = ({ children }) => {
const apolloClient = useApolloClient();
const intl = useIntl();
const notify = useNotifier();
const authProvider = useAuthProvider({ intl, notify, apolloClient });
2020-07-20 10:12:14 +00:00
2020-07-13 15:44:02 +00:00
return (
2021-01-26 22:04:54 +00:00
<UserContext.Provider value={authProvider}>{children}</UserContext.Provider>
2020-07-13 15:44:02 +00:00
);
};
export default AuthProvider;