You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fetch.fs?8131:379 Uncaught (in promise) Error: 0 for URL
at a (Fetch.fs?8131:379)
When I try to run function (based on sample from Fable):
letgetAutoComplete(state:State)=leturl=match state.FromBase with|true-> sprintf "%s/api/v1/base_terms/?text=%s&translation_language_id=%i&page=1&per_page=5"
Domain state.SearchText state.CurrentLanguage.Value.id
|false-> sprintf "%s/api/v1/translations/?text=%s&base_term_language_id=%i&page=1&per_page=5¤t=true"
Domain state.SearchText state.CurrentBaseLanguage.Value.id
fetch url [Types.RequestProperties.Mode Types.RequestMode.Nocors]// use the fetch api to load our resource|> Promise.bind (fun res -> res.text())// get the resul|> Promise.map (fun txt ->// bind the result to make further operation
printfn "Woof! Woof! %s" txt
letdecoded= Decode.Auto.fromString<Page<ResultTranslation>>(txt,true)match decoded with| Ok translationPage ->// everything went well! great!letactualDogURL= translationPage.pages
printfn "Woof! Woof! %i" actualDogURL
| Error decodingError ->// oh the decoder encountered an error. The string that was sent back from our fetch request does not map well to our PictureInfo type.
failwith (sprintf "was unable to decode: %s. Reason: %s" txt decodingError))
Access to fetch at 'https://slownik-oriin.kropleduszy.pl:8000/api/v1/base_terms/?text=&translation_language_id=1&page=1&per_page=5' from origin 'https://fable.io' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
In principle fable-fetch is just a thin binding on top of the Fetch API.
We need to try fetching the API using raw JavaScript to see if the problem is "expected" or if it's a bug in the fable-fetch library.
Fetch.fs?8131:379 Uncaught (in promise) Error: 0 for URL
at a (Fetch.fs?8131:379)
When I try to run function (based on sample from Fable):
Proper URL is: https://slownik-oriin.kropleduszy.pl:8000/api/v1/base_terms/?text=&translation_language_id=1&page=1&per_page=5
Whole code:
The text was updated successfully, but these errors were encountered: