Compare commits
2 Commits
dd5b442377
...
2108a3b92b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2108a3b92b | ||
|
|
960b801dd2 |
@@ -105,7 +105,7 @@ exports.checkIn = async () => {
|
|||||||
if (!runningClientConfig?.id || runningClientConfig.id == null) {
|
if (!runningClientConfig?.id || runningClientConfig.id == null) {
|
||||||
// ID was not found in the config, creating a new node
|
// ID was not found in the config, creating a new node
|
||||||
reqOptions = new requestOptions("/nodes/newNode", "POST");
|
reqOptions = new requestOptions("/nodes/newNode", "POST");
|
||||||
sendHttpRequest(reqOptions, JSON.stringify(), (responseObject) => {
|
sendHttpRequest(reqOptions, JSON.stringify({}), (responseObject) => {
|
||||||
// Update the client's ID if the server accepted it
|
// Update the client's ID if the server accepted it
|
||||||
if (responseObject.statusCode === 202) {
|
if (responseObject.statusCode === 202) {
|
||||||
runningClientConfig.id = responseObject.body.nodeId;
|
runningClientConfig.id = responseObject.body.nodeId;
|
||||||
@@ -114,6 +114,7 @@ exports.checkIn = async () => {
|
|||||||
|
|
||||||
if (responseObject.statusCode >= 300) {
|
if (responseObject.statusCode >= 300) {
|
||||||
// Server threw an error
|
// Server threw an error
|
||||||
|
log.DEBUG("HTTP Error: ", responseObject);
|
||||||
onHttpError(responseObject.statusCode);
|
onHttpError(responseObject.statusCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ exports.listAllNodes = async (req, res) => {
|
|||||||
|
|
||||||
// Add a new node to the storage
|
// Add a new node to the storage
|
||||||
exports.newNode = async (req, res) => {
|
exports.newNode = async (req, res) => {
|
||||||
if (!req.body.name) return res.send(400)
|
if (!req.body.name) return res.status(400).json("No name specified for new node");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Try to add the new user with defaults if missing options
|
// Try to add the new user with defaults if missing options
|
||||||
|
|||||||
Reference in New Issue
Block a user