-
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.
- Loading branch information
1 parent
b4c4413
commit 392caa7
Showing
4 changed files
with
67 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -141,4 +141,61 @@ async function testConnection(){ | |
const response_body = await res.json(); // Parse the response body as JSON | ||
console.log(response_body) | ||
} | ||
onSubmit() | ||
|
||
async function testLogin(){ | ||
const res = await fetch("http://178.128.192.215:8000/api/signIn/", { | ||
method: "POST", | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
body: JSON.stringify({ | ||
email: "[email protected]", //username entered by the user in textbox | ||
password: "gend55@opqqq" //password entered by the user in textbox | ||
}), //"email": "[email protected]", password: "Sahar1364" | ||
}); | ||
let json = await res.json(); | ||
console.log(json); | ||
|
||
} | ||
testLogin(); | ||
|
||
async function testSignup(){ | ||
const res = fetch("http://178.128.192.215:8000/api/signup/", { | ||
method: "POST", | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
body: JSON.stringify({ | ||
email: "[email protected]", //username entered by the user in textbox | ||
password: "gend55@opqqq" //password entered by the user in textbox | ||
}), //"email": "[email protected]", password: "Sahar1364" | ||
}).then((response) => { | ||
console.log("Test"); | ||
return response.json(); | ||
}).then((data) => { | ||
console.log(data); | ||
}).catch((error) => { | ||
console.log(error); | ||
}); | ||
|
||
|
||
} | ||
|
||
|
||
|
||
|
||
async function testFilter(sensorData, container_id){ | ||
let containerLocations = sensorData.filter((sensor) => sensor.container_id == container_id && sensor.sensor_type == "GPS") | ||
latestcontainerLocations = containerLocations.reduce((latest, current) => { | ||
if (latest.timestamp > current.timestamp) { | ||
return latest | ||
} else { | ||
return current | ||
} | ||
|
||
}) | ||
containerLocations = containerLocations.map((sensor) => sensor.sensor_data) | ||
containerLocations = containerLocations.map((sensor) => sensor.split(",")) | ||
|
||
|
||
} |
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