fix
Some checks failed
Create and publish a Docker image / Deploy image (push) Has been skipped
Create and publish a Docker image / Publish image (push) Failing after 38s

This commit is contained in:
VITALY-VORON 2023-08-25 18:51:46 +03:00
parent 754425a5ca
commit 5cede13ca3
5 changed files with 21 additions and 19 deletions

View File

@ -1,14 +1,16 @@
import React, {useState} from 'react'; import React, {useState, useEffect} from 'react';
import Start from './components/Start/Start'; import Start from './components/Start/Start';
import Second from './components/Second/Second'; import Second from './components/Second/Second';
import Tinder from './components/Tinder/Tinder'; import Tinder from './components/Tinder/Tinder';
import Map from './components/Map/Map'; import Map from './components/Map/Map';
import './App.css' import axios from 'axios';
import './App.css';
function App() { function App() {
const [buttonValue, setButtonValue] = useState(""); const [buttonValue, setButtonValue] = useState("");
const [isHidden, setIsHidden] = useState(false); const [isHidden, setIsHidden] = useState(false);
const [cardInfo, setCardInfo] = useState([]);
const handleButtonValue = (value) => { const handleButtonValue = (value) => {
setIsHidden(true); setIsHidden(true);
@ -18,13 +20,27 @@ function App() {
}, 300); }, 300);
}; };
useEffect(() => {
const fetchData = () => {
axios.get('https://easytravel.zetcraft.ru/v1/GetAllCards')
.then(response => {
setCardInfo(response.data);
console.log(cardInfo.length);
})
.catch(error => {
console.error('Error fetching data:', error);
});
}
fetchData();
}, []);
let content = null; let content = null;
switch (buttonValue) { switch (buttonValue) {
case '/': case '/':
content = <Second getValue={handleButtonValue}/> content = <Second getValue={handleButtonValue}/>
break; break;
case '/tinder': case '/tinder':
content = <Tinder getValue={handleButtonValue}/> content = <Tinder getValue={handleButtonValue} cardInfo={cardInfo}/>
break; break;
case '/map': case '/map':
content = <Map/> content = <Map/>

View File

@ -12,6 +12,7 @@ const Start = (props) => {
flexWrap: 'wrap', flexWrap: 'wrap',
justifyContent: 'space-evenly', justifyContent: 'space-evenly',
height: '95vh', height: '95vh',
background: 'linear-gradient(180deg, #7EAFE7 0.27%, rgba(41, 134, 242, 0.38) 27.08%, rgba(41, 134, 242, 0.35) 31.77%, rgba(152, 198, 253, 0.28) 46.35%, rgba(41, 134, 242, 0.00) 100%)',
overflow: 'hidden', overflow: 'hidden',
}}> }}>
<span style={{ <span style={{

View File

@ -7,7 +7,6 @@
align-items: center; align-items: center;
flex-direction: column; flex-direction: column;
overflow: hidden; overflow: hidden;
background-color: #fff;
} }
.card-container { .card-container {

View File

@ -6,25 +6,11 @@ import axios from 'axios';
const Tinder = (props) => { const Tinder = (props) => {
const route = props.getValue; const route = props.getValue;
const cardInfo = props.cardInfo;
const [lastDirection, setLastDirection] = useState(); const [lastDirection, setLastDirection] = useState();
const [cardId, setCardId] = useState([]); const [cardId, setCardId] = useState([]);
const [allIds, setAllIds] = useState([]); const [allIds, setAllIds] = useState([]);
const [cardInfo, setCardInfo] = useState([]);
useEffect(() => {
const fetchData = () => {
axios.get('https://easytravel.zetcraft.ru/v1/GetAllCards')
.then(response => {
setCardInfo(response.data);
console.log(cardInfo.length);
})
.catch(error => {
console.error('Error fetching data:', error);
});
}
fetchData();
}, []);
const swiped = (direction, id) => { const swiped = (direction, id) => {
setLastDirection(direction); setLastDirection(direction);

0
src/setupTests.js Normal file
View File