hi, I need help with my code, it wasn’t previously like this before I upgraded to premium.
//my backend code (file called time/jsw)
import { fetch } from 'wix-fetch';
export async function whatTime() {
let url = "https://timezone.abstractapi.com/v1/current_time/?api_key=53ed50861ece46b1b64abc648bdd22d6&location=Asia, Jakarta"
return fetch(url, {
"method": "get"
})
.then((httpResponse) => {
if (httpResponse.ok) {
return httpResponse.json()
} else {
return Promise.reject("Fetch did not succeed");
}
})
.catch(err => console.log(err))
}
//the code on my page
import { whatTime } from 'backend/time.jsw'
$w.onReady(function () {
whatTime()
.then(json => console.log(json.datetime))
})
On preview, this works like a charm.

this also works on browser when I did not upgrade to premium. But now, it does work ![]()
and if i remove “datetime” (only returning the json), on preview it works!

but on browser does not. I have tried on chrome, safari, and edge

I have tried other ways too, they work on preview, but doesn’t work in live site.
//alternative 1
import { whatTime } from 'backend/time.jsw'
$w.onReady(function () {
whatTime()
.then((function(json){
console.log(json.datetime)
}))
});
//alternative 2
import { whatTime } from 'backend/time.jsw'
$w.onReady( function () {
whatTime()
.then((json) => {
console.log(json.datetime)
})
});
i have also ensured it is accessible to anyone

thanks in advance!
