chore: move hardcoded api key to .env file
This commit is contained in:
@@ -47,7 +47,7 @@ const initialRenamePopupState: RenamePopupState = {
|
|||||||
|
|
||||||
const Index = () => {
|
const Index = () => {
|
||||||
const [apiKey, setApiKey] = useState<string>(
|
const [apiKey, setApiKey] = useState<string>(
|
||||||
"ptlc_N77A2hEczFmSwGXm4cEXh4Gw3ZP0Ygr5NaBkGlE7pjU"
|
`${process.env.NEXT_PUBLIC_API_KEY}`
|
||||||
);
|
);
|
||||||
const [fileList, setFileList] = useState<FileProps[]>([]);
|
const [fileList, setFileList] = useState<FileProps[]>([]);
|
||||||
const [contextMenu, setContextMenu] = useState<ContextMenuState>(
|
const [contextMenu, setContextMenu] = useState<ContextMenuState>(
|
||||||
@@ -112,15 +112,14 @@ const Index = () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const setupApplication = async () => {
|
const setupApplication = () => {
|
||||||
if (!apiKey || !serverId) return; // Upewniamy się, że mamy apiKey i serverId
|
if (!apiKey || !serverId) return; // Upewniamy się, że mamy apiKey i serverId
|
||||||
if (!ptero) {
|
if (!ptero) {
|
||||||
console.log("tworze instancje ptero");
|
const pteroInstance = new Pterodactyl(serverId, apiKey);
|
||||||
const pteroInstance = await new Pterodactyl(serverId, apiKey);
|
|
||||||
setPtero(pteroInstance);
|
setPtero(pteroInstance);
|
||||||
|
|
||||||
pteroInstance.helpers.setWorkingDirectory(pathParam);
|
pteroInstance.helpers.setWorkingDirectory(pathParam);
|
||||||
await fetchFiles(pteroInstance); // Wywołanie fetchFiles raz po ustawieniu instancji
|
fetchFiles(pteroInstance); // Wywołanie fetchFiles raz po ustawieniu instancji
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user