Unable to resolve host


Hi, I am new with NativeScript and i have an error with this function from groceries NativeScript template

viewModel.login = function() {
return fetchModule.fetch(“https://LINK/api/restifydb/…” + “oauth/token”, {
method: “POST”,
body: JSON.stringify({
username: viewModel.get(“email”),
password: viewModel.get(“password”),
grant_type: “password”
headers: {
“Content-Type”: “application/json”
.then(function(response) {
return response.json();
.then(function(data) {
config.token = data.Result.access_token;

the error is : JS: TypeError: Network request failed: Unable to resolve host “LINK”: No address associated with hostname

the LINK is from a different server with restifydb and it is not even working on mobile device.

the permissions

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET"/>

Can anybody help !?


Can you access that endpoint from a browser? That’s the first thing I would check. Also, maybe this goes without saying, but make sure you are substituting something in for LINK - as with this code it looks like the request is just https://LINK/api/restifydb/…