-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New getVehicles() function, this seems to be a new api feature. WIP Error handling.
- Loading branch information
1 parent
cee9e81
commit c086650
Showing
10 changed files
with
117 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// WIP TO GET BETTER ERROR HANDLING FOR MORE INFO | ||
|
||
function errorHandler(int) { | ||
// Array for error messages | ||
const errorMessages = { | ||
400: 'Bad Request', | ||
401: 'Unauthorized', | ||
403: 'Forbidden (Did you forget the token or inputted it incorrectly?)', | ||
404: 'Not Found', | ||
500: 'Internal Server Error' | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const { globalConfig, apiURL } = require('../client.js') | ||
|
||
module.exports = (token) => { | ||
return new Promise(async (resolve, reject) => { | ||
const r = await fetch(`${apiURL}/server/commandlogs`, { | ||
method: 'GET', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
'Server-Key': globalConfig.token | ||
} | ||
}) | ||
if (r.status !== 200) return reject(new Error('[getCommandLogs] API Returned: ' + r.status)) | ||
else return resolve(r.json()) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const { globalConfig, apiURL } = require('../client.js') | ||
|
||
module.exports = (token) => { | ||
return new Promise(async (resolve, reject) => { | ||
const r = await fetch(`${apiURL}/server/killlogs`, { | ||
method: 'GET', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
'Server-Key': globalConfig.token | ||
} | ||
}) | ||
if (r.status !== 200) return reject(new Error('[getServerKL] API Returned: ' + r.status)) | ||
else return resolve(r.json()) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const { globalConfig, apiURL } = require('../client.js') | ||
|
||
module.exports = (token) => { | ||
return new Promise(async (resolve, reject) => { | ||
const r = await fetch(`${apiURL}/server/vehicles`, { | ||
method: 'GET', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
'Server-Key': globalConfig.token | ||
} | ||
}) | ||
if (r.status !== 200) return reject(new Error('[getVehicles] API Returned: ' + r.status)) | ||
else return resolve(r.json()) | ||
}) | ||
} |