sensorwiki with tabs and only one request

This commit is contained in:
fbruc03
2022-11-08 15:59:09 +01:00
parent e00617ac78
commit a8704316ac
12 changed files with 252 additions and 48 deletions
+18
View File
@@ -0,0 +1,18 @@
import axios from 'axios'
const fetchSensorWikiSuccess = sensors => ({
type: 'FETCH_SENSORWIKI_SUCCESS',
payload: { sensors }
})
export const fetchSensors = () => {
return async dispatch => {
try {
let sensors = await axios.get('https://api.sensors.wiki/sensors/all')
dispatch(fetchSensorWikiSuccess(sensors.data))
}
catch(e){
console.log(e)
}
}
}