In my laravel controller i'm returning a response as below
return response()->json([
'name' => 'Abigail',
'state' => 'CA',
], 400);
When i make a call from a browser using Axios the data I get back is showing the json object as a string
doing json.parse(response.data) also returns Unhandled Rejection (SyntaxError): Unexpected token in JSON at position 0
I'm using Laravel 8
the content-type is application/json and so is accept.
Is there something that needs to be included?
For the Axios call i have a class called User which contains this static login method
The login method is then called inside another file
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…