Browse Source

axios

master
Kalyax 2 years ago
parent
commit
18f636ec8c
  1. 7
      index.html
  2. 2
      main.js
  3. 5
      src/api_requests.js
  4. 6
      src/main.js

7
index.html

@ -7,7 +7,10 @@
<title>Domotique</title>
</head>
<body>
<h1 class="bg-red-500 text-3xl font-bold underline">AH!</h1>
<script type="module" src="/main.js"></script>
<header>
<marquee class="text-3xl text-red-400">DOMOTIQUE 3000</marquee>
</header>
<p id="test">t</p>
<script type="module" src="/src/main.js"></script>
</body>
</html>

2
main.js

@ -1,2 +0,0 @@
import './src/style.css';
//import axios from 'axios';

5
src/api_requests.js

@ -0,0 +1,5 @@
import axios from "axios";
export default async function getTemp(){
return await axios.get("/api/temp.php");
}

6
src/main.js

@ -0,0 +1,6 @@
import './style.css';
import getTemp from './api_requests.js';
getTemp()
.then((data) => {
document.getElementById("test").innerHTML = data;
})
Loading…
Cancel
Save