Fixes for axios
This commit is contained in:
parent
d1e1cc0ce5
commit
86a6501e86
4 changed files with 41 additions and 27 deletions
|
@ -15,7 +15,7 @@ import {
|
|||
|
||||
function play(name) {
|
||||
// Play handler
|
||||
axios.get('http://192.168.1.158:8080/play/'+name)
|
||||
axios.get('http://192.168.1.178:8080/play/'+name)
|
||||
.then(res => {
|
||||
// Still don't care about response
|
||||
})
|
||||
|
@ -26,7 +26,9 @@ function play(name) {
|
|||
|
||||
const FilesScreen = ({ navigation }) => {
|
||||
|
||||
const [movies, setValue] = useState('');
|
||||
const [movies, setValue] = useState(null);
|
||||
|
||||
const baseURL = "http://192.168.1.178:8080";
|
||||
|
||||
const navigationOptions = ({ navigation }) => {
|
||||
return {
|
||||
|
@ -40,15 +42,13 @@ function play(name) {
|
|||
|
||||
useEffect(() => {
|
||||
|
||||
axios.get('http://192.168.1.158:8080/list/')
|
||||
.then(res => {
|
||||
this.setState({
|
||||
data: res.data.data,
|
||||
})
|
||||
})
|
||||
});
|
||||
axios.get(`${baseURL}/list/`).then((response) => {
|
||||
setValue(response.data.data);
|
||||
});
|
||||
}, []);
|
||||
|
||||
|
||||
|
||||
if (!movies) return null;
|
||||
|
||||
return (
|
||||
|
||||
|
|
|
@ -13,13 +13,7 @@ import { AntDesign } from '@expo/vector-icons';
|
|||
import { MaterialCommunityIcons } from '@expo/vector-icons';
|
||||
import axios from 'axios'; // Took a while to figure out how to use it, but its simpler then the
|
||||
|
||||
function bp(name) {
|
||||
// Button press handler important
|
||||
axios.get('http://192.168.1.158:8080/'+name)
|
||||
.then(res => {
|
||||
// We don't care fore now
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
const HomeScreen = ({ navigation }) => {
|
||||
|
||||
|
@ -33,6 +27,14 @@ const HomeScreen = ({ navigation }) => {
|
|||
};
|
||||
};
|
||||
|
||||
function bp (name) {
|
||||
// Button press handler important
|
||||
axios.get('http://192.168.1.178:8080/'+name)
|
||||
.then(res => {
|
||||
// We don't care fore now
|
||||
})
|
||||
}
|
||||
|
||||
const [value, setValue] = useState('value');
|
||||
const { getItem, setItem } = useAsyncStorage('@storage_key');
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue