All files app.tsx

90.41% Statements 66/73
100% Branches 1/1
20% Functions 1/5
90.41% Lines 66/73

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 741x 1x 1x 1x 1x 1x 2x 2x 2x       2x 2x       2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x   1x 1x  
import NxWelcome from './nx-welcome';
 
import {Route, Routes, Link} from 'react-router-dom';
import {useEffect} from "react";
 
export function App() {
 
 
  const getApiDev = async () => {
    const response = await fetch('http://localhost:3333/api');
    console.log("API DEV", response);
  }
 
  const getApiProd = async () => {
    const response = await fetch('https://events-manager-api-cd.herokuapp.com/api');
    console.log("API PROD", response);
  }
 
  // useEffect(() => {
  //   (async () => {
  //     await fetch('http://localhost:3333/api').then(res => res.json()
  //     ).catch(err => console.log(err));
  //   })()
  // }, [])
 
  return (
    <>
      <NxWelcome title="web"/>
      <div/>
 
      <button style={{fontSize:30, position:"fixed", top:0, left:"50%"}} onClick={() => getApiProd()}>GET API CALL!! </button>
 
      {/* START: routes */}
      {/* These routes and navigation have been generated for you */}
      {/* Feel free to move and update them to fit your needs */}
      <br/>
      <hr/>
      <br/>
      <div role="navigation">
        <ul>
          <li>
            <Link to="/">Home</Link>
          </li>
          <li>
            <Link to="/page-2">Page 2</Link>
          </li>
        </ul>
      </div>
      <Routes>
        <Route
          path="/"
          element={
            <div>
              This is the generated root route.{' '}
              <Link to="/page-2">Click here for page 2.</Link>
            </div>
          }
        />
        <Route
          path="/page-2"
          element={
            <div>
              <Link to="/">Click here to go back to root page.</Link>
            </div>
          }
        />
      </Routes>
      {/* END: routes */}
    </>
  );
}
 
export default App;