Fixes for axios

This commit is contained in:
kake26 2022-01-10 21:14:46 -06:00
parent d1e1cc0ce5
commit 86a6501e86
4 changed files with 41 additions and 27 deletions

View file

@ -15,13 +15,14 @@
"@react-navigation/native-stack": "^6.2.5", "@react-navigation/native-stack": "^6.2.5",
"axios": "^0.24.0", "axios": "^0.24.0",
"expo": "^44.0.3", "expo": "^44.0.3",
"expo-status-bar": "~1.1.0", "expo-status-bar": "~1.2.0",
"react": "17.0.1", "react": "17.0.1",
"react-dom": "17.0.1", "react-dom": "17.0.1",
"react-native": "0.64.3", "react-native": "0.64.3",
"react-native-elements": "^3.4.2", "react-native-elements": "^3.4.2",
"react-native-safe-area-context": "3.3.2", "react-native-safe-area-context": "3.3.2",
"react-native-screens": "~3.8.0", "react-native-screen": "^1.0.1",
"react-native-screens": "~3.10.1",
"react-native-web": "0.17.1" "react-native-web": "0.17.1"
}, },
"devDependencies": { "devDependencies": {

View file

@ -15,7 +15,7 @@ import {
function play(name) { function play(name) {
// Play handler // Play handler
axios.get('http://192.168.1.158:8080/play/'+name) axios.get('http://192.168.1.178:8080/play/'+name)
.then(res => { .then(res => {
// Still don't care about response // Still don't care about response
}) })
@ -26,7 +26,9 @@ function play(name) {
const FilesScreen = ({ navigation }) => { const FilesScreen = ({ navigation }) => {
const [movies, setValue] = useState(''); const [movies, setValue] = useState(null);
const baseURL = "http://192.168.1.178:8080";
const navigationOptions = ({ navigation }) => { const navigationOptions = ({ navigation }) => {
return { return {
@ -40,15 +42,13 @@ function play(name) {
useEffect(() => { useEffect(() => {
axios.get('http://192.168.1.158:8080/list/') axios.get(`${baseURL}/list/`).then((response) => {
.then(res => { setValue(response.data.data);
this.setState({ });
data: res.data.data, }, []);
})
})
});
if (!movies) return null;
return ( return (

View file

@ -13,13 +13,7 @@ import { AntDesign } from '@expo/vector-icons';
import { MaterialCommunityIcons } 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 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 }) => { 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 [value, setValue] = useState('value');
const { getItem, setItem } = useAsyncStorage('@storage_key'); const { getItem, setItem } = useAsyncStorage('@storage_key');

View file

@ -2604,10 +2604,10 @@ expo-modules-core@0.6.3:
compare-versions "^3.4.0" compare-versions "^3.4.0"
invariant "^2.2.4" invariant "^2.2.4"
expo-status-bar@~1.1.0: expo-status-bar@~1.2.0:
version "1.1.0" version "1.2.0"
resolved "https://registry.yarnpkg.com/expo-status-bar/-/expo-status-bar-1.1.0.tgz#b1015a69c8563b7cadcb5b6c726227397610725d" resolved "https://registry.yarnpkg.com/expo-status-bar/-/expo-status-bar-1.2.0.tgz#16e73205da563f9536f562e439081e30e318a82e"
integrity sha512-XgAbGfDV/Q6br2h4yzQwcZRYi37bZ/nvc06vvaJ7i7w9tRxb05OJmXBxl7ywkKlFCMcN6q3Miaf2wnzEgMwJoQ== integrity sha512-pVZZ/kDCXFK79E4dCtRecs3XLC8aiwlciutSd/fFmUPJSQZ1Txia6hlKajPt0GAYft8/YnT0V3URXzWZOBniYQ==
expo@^44.0.3: expo@^44.0.3:
version "44.0.3" version "44.0.3"
@ -4535,6 +4535,11 @@ react-dom@17.0.1:
object-assign "^4.1.1" object-assign "^4.1.1"
scheduler "^0.20.1" scheduler "^0.20.1"
react-freeze@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/react-freeze/-/react-freeze-1.0.0.tgz#b21c65fe1783743007c8c9a2952b1c8879a77354"
integrity sha512-yQaiOqDmoKqks56LN9MTgY06O0qQHgV4FUrikH357DydArSZHQhl0BJFqGKIZoTqi8JizF9Dxhuk1FIZD6qCaw==
react-is@^16.13.0, react-is@^16.7.0, react-is@^16.8.1: react-is@^16.13.0, react-is@^16.7.0, react-is@^16.8.1:
version "16.13.1" version "16.13.1"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
@ -4580,11 +4585,17 @@ react-native-safe-area-context@3.3.2:
resolved "https://registry.yarnpkg.com/react-native-safe-area-context/-/react-native-safe-area-context-3.3.2.tgz#9549a2ce580f2374edb05e49d661258d1b8bcaed" resolved "https://registry.yarnpkg.com/react-native-safe-area-context/-/react-native-safe-area-context-3.3.2.tgz#9549a2ce580f2374edb05e49d661258d1b8bcaed"
integrity sha512-yOwiiPJ1rk+/nfK13eafbpW6sKW0jOnsRem2C1LPJjM3tfTof6hlvV5eWHATye3XOpu2cJ7N+HdkUvUDGwFD2Q== integrity sha512-yOwiiPJ1rk+/nfK13eafbpW6sKW0jOnsRem2C1LPJjM3tfTof6hlvV5eWHATye3XOpu2cJ7N+HdkUvUDGwFD2Q==
react-native-screens@~3.8.0: react-native-screen@^1.0.1:
version "3.8.0" version "1.0.1"
resolved "https://registry.yarnpkg.com/react-native-screens/-/react-native-screens-3.8.0.tgz#4ec84c55a7b4a4aa9405c812978ca2ba5c0242a4" resolved "https://registry.yarnpkg.com/react-native-screen/-/react-native-screen-1.0.1.tgz#80598bb86ade91e2fd277dfe6423132371eadb49"
integrity sha512-lHrnB/elAoMJKv8O12U6BLgeup4lB6ZKJHEOVuG/D72nv/OE9wUusbou6YCB5tp3YbaSpHflPnkFmHA/vCejpw== integrity sha512-wdgUV2B/1XIBG1zhyLWtCkDwc2CpfF/TiZdkRnRtSlgibc6Rzjnc96cjYjRLKq8xS229m9+VXP2rbciZLDaBaQ==
react-native-screens@~3.10.1:
version "3.10.1"
resolved "https://registry.yarnpkg.com/react-native-screens/-/react-native-screens-3.10.1.tgz#2634a1a17380c559a06de391e4969ae72c4365ff"
integrity sha512-ZF/XHnRsuinvDY1XiCWLXxoUoSf+NgsAes2SZfX9rFQQcv128zmh/+19SSavGrSf6rQNzqytEMdRGI6yr4Gbjw==
dependencies: dependencies:
react-freeze "^1.0.0"
warn-once "^0.1.0" warn-once "^0.1.0"
react-native-size-matters@^0.3.1: react-native-size-matters@^0.3.1: