mirror of
https://github.com/hubHarmony/servii-frontend.git
synced 2024-11-18 05:40:31 +00:00
[+] Api Fix
This commit is contained in:
parent
6cf8488476
commit
3886029191
@ -6,6 +6,7 @@ import NoServer from '../NoServer/NoServer';
|
|||||||
import { getUserSubdomain } from "../../service/firebase";
|
import { getUserSubdomain } from "../../service/firebase";
|
||||||
import '../../service/api.tsx';
|
import '../../service/api.tsx';
|
||||||
import serviiApi from "../../service/api.tsx";
|
import serviiApi from "../../service/api.tsx";
|
||||||
|
import Api from "../../service/api.tsx";
|
||||||
|
|
||||||
|
|
||||||
const DashboardPage = ({ user }) => {
|
const DashboardPage = ({ user }) => {
|
||||||
|
@ -44,16 +44,16 @@ interface CommandRequest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
enum serviiRequest {
|
enum serviiRequest {
|
||||||
setSubdomain = 'setSubdomain',
|
setSubdomain = 'SetSubdomain',
|
||||||
fetchServers = 'fetchServers',
|
fetchServers = 'FetchServers',
|
||||||
accountCreate = 'accountCreate',
|
accountCreate = 'AccountCreate',
|
||||||
serverCreate = 'serverCreate',
|
serverCreate = 'ServerCreate',
|
||||||
serverDelete = 'serverDelete',
|
serverDelete = 'ServerDelete',
|
||||||
accountDelete = 'accountDelete',
|
accountDelete = 'AccountDelete',
|
||||||
serverRun = 'serverRun',
|
serverRun = 'ServerRun',
|
||||||
serverStop = 'serverStop',
|
serverStop = 'ServerStop',
|
||||||
updateProperty = 'updateProperty',
|
updateProperty = 'UpdateProperty',
|
||||||
command = 'command',
|
command = 'Command',
|
||||||
}
|
}
|
||||||
|
|
||||||
class serviiApi {
|
class serviiApi {
|
||||||
@ -67,14 +67,17 @@ class serviiApi {
|
|||||||
},
|
},
|
||||||
body: JSON.stringify(body),
|
body: JSON.stringify(body),
|
||||||
});
|
});
|
||||||
const status = response.status
|
const status: number = response.status
|
||||||
const json = await response.json();
|
const json = await response.json();
|
||||||
|
|
||||||
if ('message' in json) {
|
if (json.message === undefined) {
|
||||||
return {return_code: status, message: json.message};
|
if (!(endpoint === serviiRequest.fetchServers)){
|
||||||
}
|
|
||||||
return {return_code: status, message: "Couldn't find an available API, we're sorry for the inconvenience."};
|
return {return_code: status, message: "Couldn't find an available API, we're sorry for the inconvenience."};
|
||||||
}
|
}
|
||||||
|
return {return_code: status, message: json};
|
||||||
|
}
|
||||||
|
return {return_code: status, message: json.message};
|
||||||
|
}
|
||||||
|
|
||||||
private static token(): string {
|
private static token(): string {
|
||||||
const currentUser = getAuth().currentUser;
|
const currentUser = getAuth().currentUser;
|
||||||
|
Loading…
Reference in New Issue
Block a user