Spaces:
Sleeping
Sleeping
Commit Β·
2f7bf0f
1
Parent(s): cd8b88c
Done the configuration
Browse files- frontend/js/db.js +2 -2
frontend/js/db.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
js/db.js β Live Neon DB Helpers
|
| 3 |
βββββββββββββββββββββββββββββββββββββββββ */
|
| 4 |
|
| 5 |
-
const API_URL = "/invoices"; // Relative path since frontend/backend are on same host
|
| 6 |
|
| 7 |
/* No need to "Open" a local DB anymore, but we'll keep the function
|
| 8 |
so app.js doesn't break. We'll just return true. */
|
|
@@ -14,7 +14,7 @@ async function dbOpen() {
|
|
| 14 |
/* Save one invoice record to Neon */
|
| 15 |
async function dbSave(data) {
|
| 16 |
try {
|
| 17 |
-
|
| 18 |
method: 'POST',
|
| 19 |
headers: {
|
| 20 |
'Content-Type': 'application/json',
|
|
|
|
| 2 |
js/db.js β Live Neon DB Helpers
|
| 3 |
βββββββββββββββββββββββββββββββββββββββββ */
|
| 4 |
|
| 5 |
+
const API_URL = "/api/invoices"; // Relative path since frontend/backend are on same host
|
| 6 |
|
| 7 |
/* No need to "Open" a local DB anymore, but we'll keep the function
|
| 8 |
so app.js doesn't break. We'll just return true. */
|
|
|
|
| 14 |
/* Save one invoice record to Neon */
|
| 15 |
async function dbSave(data) {
|
| 16 |
try {
|
| 17 |
+
const response = await fetch(`${API_URL}`, {
|
| 18 |
method: 'POST',
|
| 19 |
headers: {
|
| 20 |
'Content-Type': 'application/json',
|