start on working on s3 access
This commit is contained in:
parent
9884232639
commit
bd645e1efb
|
@ -13,7 +13,7 @@ interface InstallationContextProviderProps {
|
|||
setError: (value: AxiosError) => void;
|
||||
}
|
||||
|
||||
export const InstallationContext =
|
||||
export const InstallationsContext =
|
||||
createContext<InstallationContextProviderProps>({
|
||||
data: [],
|
||||
setData: () => {},
|
||||
|
@ -23,7 +23,11 @@ export const InstallationContext =
|
|||
setError: () => {},
|
||||
});
|
||||
|
||||
const InstallationContextProvider = ({ children }: { children: ReactNode }) => {
|
||||
const InstallationsContextProvider = ({
|
||||
children,
|
||||
}: {
|
||||
children: ReactNode;
|
||||
}) => {
|
||||
const [data, setData] = useState<I_Installation[]>([]);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [error, setError] = useState<AxiosError>();
|
||||
|
@ -43,12 +47,12 @@ const InstallationContextProvider = ({ children }: { children: ReactNode }) => {
|
|||
}, []);
|
||||
|
||||
return (
|
||||
<InstallationContext.Provider
|
||||
<InstallationsContext.Provider
|
||||
value={{ data, setData, fetchData, loading, setLoading, error, setError }}
|
||||
>
|
||||
{children}
|
||||
</InstallationContext.Provider>
|
||||
</InstallationsContext.Provider>
|
||||
);
|
||||
};
|
||||
|
||||
export default InstallationContextProvider;
|
||||
export default InstallationsContextProvider;
|
|
@ -0,0 +1,29 @@
|
|||
import { createContext, ReactNode, useState } from "react";
|
||||
import { I_User } from "../../util/user.util";
|
||||
|
||||
interface InstallationContextProviderProps {
|
||||
s3Credentials?: I_User;
|
||||
setS3Credentials: (value: I_User) => void;
|
||||
}
|
||||
|
||||
export const UserContext = createContext<InstallationContextProviderProps>({
|
||||
s3Credentials: {} as I_User,
|
||||
setS3Credentials: () => {},
|
||||
});
|
||||
|
||||
const UserContextProvider = ({ children }: { children: ReactNode }) => {
|
||||
const [s3Credentials, setS3Credentials] = useState<I_User>();
|
||||
|
||||
return (
|
||||
<UserContext.Provider
|
||||
value={{
|
||||
s3Credentials: s3Credentials,
|
||||
setS3Credentials: setS3Credentials,
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</UserContext.Provider>
|
||||
);
|
||||
};
|
||||
|
||||
export default UserContextProvider;
|
Loading…
Reference in New Issue