Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const wifi = async () => {
try {
const data = await WifiManager.connectToProtectedSSID(
ssid,
password,
isWep,
);
console.log('Connected successfully!', {data});
setConneted({connected: true, ssid});
} catch (error) {
setConneted({connected: false, error: error.message});
console.log('Connection failed!', {error});
}
try {
const ssid = await WifiManager.getCurrentWifiSSID();
setSsid(ssid);
console.log('Your current connected wifi SSID is ' + ssid);
} catch (error) {
const wifi = async () => {
try {
const data = await WifiManager.connectToProtectedSSID(
ssid,
password,
isWep,
);
console.log('Connected successfully!', {data});
setConneted({connected: true, ssid});
} catch (error) {
setConneted({connected: false, error: error.message});
console.log('Connection failed!', {error});
}
try {
const ssid = await WifiManager.getCurrentWifiSSID();
setSsid(ssid);
console.log('Your current connected wifi SSID is ' + ssid);
} catch (error) {
setSsid('Cannot get current SSID!' + error.message);
console.log('Cannot get current SSID!', {error});
}
};
useEffect(() => {