This commit is contained in:
Charles Le Maux 2024-07-03 14:31:15 +01:00
parent b69adc4ed4
commit ce5f30dee3
2 changed files with 7 additions and 7 deletions

View File

@ -1,7 +1,7 @@
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import styles from './CreateServer.module.scss'; import styles from './CreateServer.module.scss';
import { getUserSubdomain } from "../../service/firebase"; import { getUserSubdomain } from "../../service/firebase";
import { saveSubdomain } from "../../service/api.tsx"; import serviiApi from "../../service/api.tsx";
const CreateServer = ({ user, onCreateServer }) => { const CreateServer = ({ user, onCreateServer }) => {
const [subdomain, setSubdomain] = useState(null); const [subdomain, setSubdomain] = useState(null);
@ -26,7 +26,7 @@ const CreateServer = ({ user, onCreateServer }) => {
const handleSaveSubdomain = async () => { const handleSaveSubdomain = async () => {
try { try {
await saveSubdomain(subdomainInput); await serviiApi.setSubdomain(subdomainInput);
setSubdomain(subdomainInput); setSubdomain(subdomainInput);
} catch (error) { } catch (error) {
console.error('Error setting subdomain:', error); console.error('Error setting subdomain:', error);

View File

@ -32,8 +32,8 @@ const DashboardPage = ({ user }) => {
try { try {
const serverName = prompt('Enter the name for the new server:'); const serverName = prompt('Enter the name for the new server:');
if (!serverName) return; if (!serverName) return;
await createServer(serverName); await serviiApi.serverCreate(serverName, "1.20.6", "paper");
loadServers(); await loadServers();
} catch (error) { } catch (error) {
console.error('Error creating server:', error); console.error('Error creating server:', error);
} }
@ -41,7 +41,7 @@ const DashboardPage = ({ user }) => {
const handleRunServer = async (serverName) => { const handleRunServer = async (serverName) => {
try { try {
await runServer(serverName); await serviiApi.serverRun(serverName);
} catch (error) { } catch (error) {
console.error('Error starting server:', error); console.error('Error starting server:', error);
} }
@ -49,7 +49,7 @@ const DashboardPage = ({ user }) => {
const handleStopServer = async (serverName) => { const handleStopServer = async (serverName) => {
try { try {
await stopServer(serverName); await serviiApi.serverStop(serverName);
} catch (error) { } catch (error) {
console.error('Error stopping server:', error); console.error('Error stopping server:', error);
} }
@ -57,7 +57,7 @@ const DashboardPage = ({ user }) => {
const handleDeleteServer = async (serverName) => { const handleDeleteServer = async (serverName) => {
try { try {
await deleteServer(serverName); await serviiApi.serverDelete(serverName);
loadServers(); loadServers();
} catch (error) { } catch (error) {
console.error('Error deleting server:', error); console.error('Error deleting server:', error);