chore: move hardcoded api key to .env file

This commit is contained in:
2024-09-10 20:15:35 +00:00
parent ae4152dc06
commit 508306218d

View File

@@ -47,7 +47,7 @@ const initialRenamePopupState: RenamePopupState = {
const Index = () => {
const [apiKey, setApiKey] = useState<string>(
"ptlc_N77A2hEczFmSwGXm4cEXh4Gw3ZP0Ygr5NaBkGlE7pjU"
`${process.env.NEXT_PUBLIC_API_KEY}`
);
const [fileList, setFileList] = useState<FileProps[]>([]);
const [contextMenu, setContextMenu] = useState<ContextMenuState>(
@@ -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
}
};