mirror of
https://github.com/hubHarmony/servii-frontend.git
synced 2024-11-17 21:40:30 +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 '../../service/api.tsx';
|
||||
import serviiApi from "../../service/api.tsx";
|
||||
import Api from "../../service/api.tsx";
|
||||
|
||||
|
||||
const DashboardPage = ({ user }) => {
|
||||
|
@ -44,16 +44,16 @@ interface CommandRequest {
|
||||
}
|
||||
|
||||
enum serviiRequest {
|
||||
setSubdomain = 'setSubdomain',
|
||||
fetchServers = 'fetchServers',
|
||||
accountCreate = 'accountCreate',
|
||||
serverCreate = 'serverCreate',
|
||||
serverDelete = 'serverDelete',
|
||||
accountDelete = 'accountDelete',
|
||||
serverRun = 'serverRun',
|
||||
serverStop = 'serverStop',
|
||||
updateProperty = 'updateProperty',
|
||||
command = 'command',
|
||||
setSubdomain = 'SetSubdomain',
|
||||
fetchServers = 'FetchServers',
|
||||
accountCreate = 'AccountCreate',
|
||||
serverCreate = 'ServerCreate',
|
||||
serverDelete = 'ServerDelete',
|
||||
accountDelete = 'AccountDelete',
|
||||
serverRun = 'ServerRun',
|
||||
serverStop = 'ServerStop',
|
||||
updateProperty = 'UpdateProperty',
|
||||
command = 'Command',
|
||||
}
|
||||
|
||||
class serviiApi {
|
||||
@ -67,13 +67,16 @@ class serviiApi {
|
||||
},
|
||||
body: JSON.stringify(body),
|
||||
});
|
||||
const status = response.status
|
||||
const status: number = response.status
|
||||
const json = await response.json();
|
||||
|
||||
if ('message' in json) {
|
||||
return {return_code: status, message: json.message};
|
||||
if (json.message === undefined) {
|
||||
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: json};
|
||||
}
|
||||
return {return_code: status, message: "Couldn't find an available API, we're sorry for the inconvenience."};
|
||||
return {return_code: status, message: json.message};
|
||||
}
|
||||
|
||||
private static token(): string {
|
||||
|
Loading…
Reference in New Issue
Block a user