HOTFIX: Fix incomplete replacement causing syntax errors in setFirebaseViaREST and readFirebaseSmart
This commit is contained in:
parent
935e1059f6
commit
5e85ad61e2
12
worker.js
12
worker.js
|
|
@ -371,12 +371,12 @@ async function updateFirebaseSmart(path, updates) {
|
||||||
async function setFirebaseViaREST(path, data) {
|
async function setFirebaseViaREST(path, data) {
|
||||||
const url = `${config.firebase.databaseURL}/${path}.json`;
|
const url = `${config.firebase.databaseURL}/${path}.json`;
|
||||||
|
|
||||||
const response = await fetch(url, {
|
const response = await fetchWithTimeout2(url, {
|
||||||
method: 'PUT',WithTimeout2(url, {
|
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify(data)
|
body: JSON.stringify(data)
|
||||||
}, 10000
|
}, 10000);
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`REST PUT failed: ${response.status}`);
|
throw new Error(`REST PUT failed: ${response.status}`);
|
||||||
}
|
}
|
||||||
|
|
@ -425,11 +425,11 @@ async function readFirebaseSmart(path) {
|
||||||
return snapshot.val();
|
return snapshot.val();
|
||||||
} catch (sdkError) {
|
} catch (sdkError) {
|
||||||
const url = `${config.firebase.databaseURL}/${path}.json`;
|
const url = `${config.firebase.databaseURL}/${path}.json`;
|
||||||
const response = await fetch(url, {
|
const response = await fetchWithTimeout2(url, {
|
||||||
method: 'GET',WithTimeout2(url, {
|
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: { 'Content-Type': 'application/json' }
|
headers: { 'Content-Type': 'application/json' }
|
||||||
}, 10000
|
}, 10000);
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`REST GET failed: ${response.status}`);
|
throw new Error(`REST GET failed: ${response.status}`);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue