-
Notifications
You must be signed in to change notification settings - Fork 0
/
popup.js
28 lines (26 loc) · 922 Bytes
/
popup.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
document.addEventListener('DOMContentLoaded', function () {
chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) {
var currentUrl = tabs[0].url;
var apiUrl = 'https://parapager.onrender.com/api'; // Replace with your actual API endpoint
var requestBody = {
site: currentUrl
};
fetch(apiUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(requestBody),
})
.then(response => response.json())
.then(data => {
var summaryElement = document.getElementById('summary');
summaryElement.textContent = data.summary;
})
.catch(error => {
console.error('Error fetching data:', error);
var summaryElement = document.getElementById('summary');
summaryElement.textContent = 'Error fetching data';
});
});
});