I am new to Axios and have problem in the simple question.
My React code:
const params = {
"id": "1",
"name":"Mike"
};
axios.request({
url: 'https://localhost:44343/api/SampleData/test',
method: 'get',
data:params
})
My asp.net core web api:
[HttpGet("test")]
public async Task Test([FromQuery]Model model)
My model:
public class Model
{
public string Id { get; set; }
public string Name { get; set; }
}
I failed to pass the js object as query string to my api code. model data is null for Id and Name.
model