From 508306218d8f7c5a7da4734cb3664356c30410f0 Mon Sep 17 00:00:00 2001 From: przeq piciel Date: Tue, 10 Sep 2024 20:15:35 +0000 Subject: [PATCH] chore: move hardcoded api key to .env file --- app/components/FilesEditor/index.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/components/FilesEditor/index.tsx b/app/components/FilesEditor/index.tsx index 2f557cf..5cdcfd9 100644 --- a/app/components/FilesEditor/index.tsx +++ b/app/components/FilesEditor/index.tsx @@ -47,7 +47,7 @@ const initialRenamePopupState: RenamePopupState = { const Index = () => { const [apiKey, setApiKey] = useState( - "ptlc_N77A2hEczFmSwGXm4cEXh4Gw3ZP0Ygr5NaBkGlE7pjU" + `${process.env.NEXT_PUBLIC_API_KEY}` ); const [fileList, setFileList] = useState([]); const [contextMenu, setContextMenu] = useState( @@ -112,15 +112,14 @@ const Index = () => { ); useEffect(() => { - const setupApplication = async () => { + const setupApplication = () => { if (!apiKey || !serverId) return; // Upewniamy się, że mamy apiKey i serverId if (!ptero) { - console.log("tworze instancje ptero"); - const pteroInstance = await new Pterodactyl(serverId, apiKey); + const pteroInstance = new Pterodactyl(serverId, apiKey); setPtero(pteroInstance); pteroInstance.helpers.setWorkingDirectory(pathParam); - await fetchFiles(pteroInstance); // Wywołanie fetchFiles raz po ustawieniu instancji + fetchFiles(pteroInstance); // Wywołanie fetchFiles raz po ustawieniu instancji } };