From bd645e1efbbefce4903bbd2a5092e41207df29e4 Mon Sep 17 00:00:00 2001 From: Sina Blattmann Date: Thu, 6 Jul 2023 09:22:58 +0200 Subject: [PATCH] start on working on s3 access --- ...r.tsx => InstallationsContextProvider.tsx} | 14 +++++---- .../Context/S3CredentialsContextProvider.tsx | 29 +++++++++++++++++++ 2 files changed, 38 insertions(+), 5 deletions(-) rename typescript/Frontend/src/components/Context/{InstallationContextProvider.tsx => InstallationsContextProvider.tsx} (84%) create mode 100644 typescript/Frontend/src/components/Context/S3CredentialsContextProvider.tsx diff --git a/typescript/Frontend/src/components/Context/InstallationContextProvider.tsx b/typescript/Frontend/src/components/Context/InstallationsContextProvider.tsx similarity index 84% rename from typescript/Frontend/src/components/Context/InstallationContextProvider.tsx rename to typescript/Frontend/src/components/Context/InstallationsContextProvider.tsx index c6a231326..37a74533b 100644 --- a/typescript/Frontend/src/components/Context/InstallationContextProvider.tsx +++ b/typescript/Frontend/src/components/Context/InstallationsContextProvider.tsx @@ -13,7 +13,7 @@ interface InstallationContextProviderProps { setError: (value: AxiosError) => void; } -export const InstallationContext = +export const InstallationsContext = createContext({ data: [], setData: () => {}, @@ -23,7 +23,11 @@ export const InstallationContext = setError: () => {}, }); -const InstallationContextProvider = ({ children }: { children: ReactNode }) => { +const InstallationsContextProvider = ({ + children, +}: { + children: ReactNode; +}) => { const [data, setData] = useState([]); const [loading, setLoading] = useState(false); const [error, setError] = useState(); @@ -43,12 +47,12 @@ const InstallationContextProvider = ({ children }: { children: ReactNode }) => { }, []); return ( - {children} - + ); }; -export default InstallationContextProvider; +export default InstallationsContextProvider; diff --git a/typescript/Frontend/src/components/Context/S3CredentialsContextProvider.tsx b/typescript/Frontend/src/components/Context/S3CredentialsContextProvider.tsx new file mode 100644 index 000000000..c3f32d8bd --- /dev/null +++ b/typescript/Frontend/src/components/Context/S3CredentialsContextProvider.tsx @@ -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({ + s3Credentials: {} as I_User, + setS3Credentials: () => {}, +}); + +const UserContextProvider = ({ children }: { children: ReactNode }) => { + const [s3Credentials, setS3Credentials] = useState(); + + return ( + + {children} + + ); +}; + +export default UserContextProvider;