-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdashboard.js
36 lines (34 loc) · 1.11 KB
/
dashboard.js
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
window.addEventListener("DOMContentLoaded", ()=>{
updateQuote()
updateQuote1()
})
async function updateQuote() {
// Fetch a random quote from the Quotable API
let quotes = document.getElementById("quotes")
let author = document.getElementById("author")
const response = await fetch("https://api.quotable.io/random");
const data = await response.json();
if (response.ok) {
// Update DOM elements
quotes.textContent = data.content;
author.textContent = data.author;
} else {
quote.textContent = "An error occured";
console.log(data);
}
}
async function updateQuote1() {
// Fetch a random quote from the Quotable API
let quotes = document.getElementById("quotes")
let author = document.getElementById("author")
const response = await fetch("https://api.quotable.io/random");
const data = await response.json();
if (response.ok) {
// Update DOM elements
quotes1.textContent = data.content;
author1.textContent = data.author;
} else {
quote.textContent = "An error occured";
console.log(data);
}
}