I am using API sauce to to connect to my backend, I have double checked all my paramaters are they are coming, tested with Postman as well and it all works. It just doesnt connect to the backend for whatever reason, when i console.log the result im to get. its shows
Object {
"config": Object {
"adapter": [Function xhrAdapter],
"baseURL": "http://127.0.0.1:8000/api",
"data": "{\"username\":\"adeyeanqar \",\"password\":\"Liverpool8\"}",
"headers": Object {
"Accept": "application/json",
"Content-Type": "application/json",
},
"maxBodyLength": -1,
"maxContentLength": -1,
"method": "post",
"timeout": 0,
"transformRequest": Array [
[Function transformRequest],
],
"transformResponse": Array [
[Function transformResponse],
],
"url": "/token/",
"validateStatus": [Function validateStatus],
"xsrfCookieName": "XSRF-TOKEN",
"xsrfHeaderName": "X-XSRF-TOKEN",
},
"data": null,
"duration": 12,
"headers": null,
"ok": false,
"originalError": [Error: Network Error],
"problem": "NETWORK_ERROR",
"status": null,
}
This is my client
import { create } from "apisauce";
const apiClient = "http://127.0.0.1:8000/api",
});
This is the endpoint for authentication
import client from "./client";
const login = (username, password) =>
client.post("/token/", { username, password });
export default {
login,
};
Ordinarily it should return a token, when i console the result.