start on working on s3 access

This commit is contained in:
Sina Blattmann 2023-07-06 09:22:58 +02:00
parent 9884232639
commit bd645e1efb
2 changed files with 38 additions and 5 deletions

View File

@ -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;

View File

@ -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;