#Axios Call -> API LARAVEL input null

2 messages · Page 1 of 1 (latest)

spiral aurora
#

Hey ! Sorry for the disturbance,

I have a problem... hum, idk why when i sent my data,

The response return a 200 but input 1 & 2 "null" but in Postman is working, i have my inputs...

Console.log onChange ( Inputs ) working

( Can see Screenshots for the response in Browser & Postman )

React

<select
                        className="bg-[#1f2937] text-white rounded-lg w-24 py-2"
                        onChange={(e) => {
                            const data = {
                                campus_id: e.target.value,
                                month:
                                    currentDate.getMonth().toString().length ==
                                    1
                                        ? "0" + (currentDate.getMonth() + 1)
                                        : currentDate.getMonth(),
                            };
                            axios
                                .get("/api/techtalks/", data as Object)
                                .then((res) => {
                                    console.log(res);
                                });
                        }}
                    >

Controller


$techTalks = TechTalk::with('user.section')
            ->whereHas('user.section', function ($query) use ($request) {
                $query->where('campus_id', $request->campus_id);
            })
            ->whereMonth('date', $request->month)
            ->get();

        return response()->json([
            'input1' => $request->month,
            'input2' => $request->campus_id,
        ]);
#

i have multiple Axios in the project, and everything is working, just not this axios