The error might came because for a few reasons such as: 1.API endpoint is incorrect. 2.Maybe CORS issues. 3.server gets error like 404 or 401
I think by solving these error can work !!