[-] Honnest mistake

This commit is contained in:
Charles Le Maux 2024-07-03 08:31:17 +01:00
parent f270e3220e
commit a7e1c514e4
4 changed files with 3638 additions and 101 deletions

3710
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -7,12 +7,16 @@
"dev": "vite",
"build": "vite build",
"lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
"preview": "vite preview",
"test": "jest"
},
"dependencies": {
"@testing-library/jest-dom": "^6.4.6",
"@testing-library/react": "^16.0.0",
"@types/jest": "^29.5.12",
"@types/node": "^20.14.9",
"firebase": "^10.12.2",
"jest": "^29.7.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-router-dom": "^6.24.0",

View File

@ -5,7 +5,7 @@ import styles from './DashboardPage.module.scss';
import NoServer from '../NoServer/NoServer';
import { getUserSubdomain } from "../../service/firebase";
import '../../service/api.tsx';
import serviiApi from "../../service/api.js";
import serviiApi from "../../service/api.tsx";
const DashboardPage = ({ user }) => {

View File

@ -78,9 +78,10 @@ class serviiApi {
}
private static token(): string {
const currentUser = getAuth().currentUser;
if (!currentUser) {throw new Error('No user is currently logged in.');}
return currentUser.uid;
//const currentUser = getAuth().currentUser;
//if (!currentUser) {throw new Error('No user is currently logged in.');}
//return currentUser.uid;
return "MpkbDMOO8PQddQgB5VgBQdTMWF53"
}
public static async setSubdomain(subdomain: string): Promise<ApiResponse> {
@ -97,31 +98,31 @@ class serviiApi {
}
public static async serverCreate(name: string, version: string, framework: string): Promise<ApiResponse> {
const payload : ServerCreationRequest = {token: this.token(), name: name, version: version, framework: framework};
return this.call(serviiRequest.setSubdomain, payload);
return this.call(serviiRequest.serverCreate, payload);
}
public static async serverDelete(name: string): Promise<ApiResponse> {
const payload : ServerRequest = {token: this.token(), name: name}
return this.call(serviiRequest.fetchServers, payload);
return this.call(serviiRequest.serverDelete, payload);
}
public static async accountDelete(): Promise<ApiResponse> {
const payload : BaseRequest = {token: this.token()}
return this.call(serviiRequest.accountCreate, payload);
return this.call(serviiRequest.accountDelete, payload);
}
public static async serverRun(name: string): Promise<ApiResponse> {
const payload : ServerRequest = {token: this.token(), name: name}
return this.call(serviiRequest.accountCreate, payload);
return this.call(serviiRequest.serverRun, payload);
}
public static async serverStop(name: string): Promise<ApiResponse> {
const payload : ServerRequest = {token: this.token(), name: name}
return this.call(serviiRequest.setSubdomain, payload);
return this.call(serviiRequest.serverStop, payload);
}
public static async updateProperty(name: string, prop: string, value: string): Promise<ApiResponse> {
const payload : UpdatePropertyRequest = {token: this.token(), name: name, prop: prop, value: value}
return this.call(serviiRequest.fetchServers, payload);
return this.call(serviiRequest.updateProperty, payload);
}
public static async command(command: string, name: string): Promise<ApiResponse> {
const payload : CommandRequest = {token: this.token(), command: command, name: name};
return this.call(serviiRequest.accountCreate, payload);
return this.call(serviiRequest.command, payload);
}
}