2022-02-21 13:32:38 +00:00
|
|
|
import { useApolloClient } from "@apollo/client";
|
2019-10-25 12:35:48 +00:00
|
|
|
import useNotifier from "@saleor/hooks/useNotifier";
|
2021-12-17 11:10:54 +00:00
|
|
|
import React from "react";
|
2021-01-26 22:04:54 +00:00
|
|
|
import { useIntl } from "react-intl";
|
2020-05-14 09:30:32 +00:00
|
|
|
|
|
|
|
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();
|
|
|
|
|
2021-12-17 11:10:54 +00:00
|
|
|
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;
|