Commit 633d33f

Robinhood <ansarithameem674@gmail.com>
2023-07-14 17:10:06
handshake bug fixed
v2
1 parent 5b35bdd
Changed files (6)
captive_portal/data/json/config.json
@@ -1,3 +0,0 @@
-{
-    "ssid":"Free WIFI"
-}
\ No newline at end of file
captive_portal/data/json/datas.json
@@ -1,4 +0,0 @@
-{
-    "handshakes": [],
-    "passwords":[]
-}
\ No newline at end of file
web/public/json/config.json
@@ -1,3 +0,0 @@
-{
-    "ssid":"Free WIFI"
-}
\ No newline at end of file
web/public/json/datas.json
@@ -1,4 +0,0 @@
-{
-    "handshakes": [],
-    "passwords":[]
-}
\ No newline at end of file
web/src/screens/helper.ts
@@ -122,7 +122,7 @@ const handleReset = async (x: "handshake" | "password") => {
 	if (x == "password") {
 		if (!confirm("Warning: \nDo you want to clear all the passwords?")) return
 		toast.promise(
-			fetch("/clear_passwords"),
+			fetch("http://172.0.0.1/clear_passwords"),
 			{
 				loading: "Clearing Passwords...",
 				success: "Passwords Cleared",
@@ -134,7 +134,7 @@ const handleReset = async (x: "handshake" | "password") => {
 	if (x == "handshake") {
 		if (!confirm("Warning: \nDo you want to clear all the handshakes?")) return
 		toast.promise(
-			fetch("/clear_handshakes"),
+			fetch("http://172.0.0.1/clear_handshakes"),
 			{
 				loading: "Clearing Handshakes...",
 				success: "Handshakes Cleared",
web/src/screens/SetupScreen.tsx
@@ -15,7 +15,7 @@ import { handleHandshakeFile, handleReset, handleSSID, handleUpload, validatePas
 const SetupScreen = ({ networks }: { networks: network[] }) => {
 	const [selectedNetwork, setSelectedNetwork] = useState<network>()
     const [selectedPassword, setSelectedPassword] = useState("")
-    const networksWithHandshake = networks.filter((network) => network.handshake)
+    const [networksWithHandshake, setNetworksWithHandshake] = useState<network[]>(networks.filter((network) => network.handshake))
 	return (
 		<div className="w-[300px] sm:w-[500px] md:w-[600px] p-5 border border-gray-700 rounded-lg items-center justify-center mt-3">
 			<Label htmlFor="ssid-change">SSID</Label>
@@ -96,7 +96,7 @@ const SetupScreen = ({ networks }: { networks: network[] }) => {
 					<Button
 						variant="destructive"
 						className="w-full md:w-2/5"
-						onClick={() => handleReset("handshake")}
+						onClick={() => { handleReset("handshake"); setNetworksWithHandshake([]) }}
 					>
 						Reset Handshakes
 					</Button>