nhayder
5 months ago
366
2
Laravel

Safari is stripping data from my response object

Posted 5 months ago by nhayder

I've been facing this problem for sometime now and i'm hoping to find the if anybody faced same issue.

i'm using laravel 5.8 with vue + vuex.

in my app i have vue function that saves text on the page to a DB whitch is working fine on chrome and firefox.

Unfortunitly the code is not working on safari and as result of that i'm getting empty object [] instead of what i'm expecting.

this is my code

    saveText({commit}, [id, text, name, wIndex]){

        axios.put('/admin/designer/api/test/', {

            elem: text,

            elemName : name,

            elemId: id,

        })

        .then(function (response) {

            commit('UPDATE_W_ELEM', [name, wIndex, response.data]);

        })

        .catch(function (error) {

            Event.$emit('requestAlertDanger'); 

        });

    },

now in safari/network i have check the request data and they are available on the browser as expected

{
    "elem":"INTR O WIDGET","
    elemName":"title",
    "elemId":6
}

Then i'm hitting the text route and in my controller i have just simple it worked spitted out

    public function test(Request $request)
    {

        return 'Worked';

    }

And i can see the work worked available on the page, so basically the data are being submitted properly and received as expected in safari.

all good till this point.

NOW i need to work with actual data so i can save them into the database?

so i replace the (worked ) with actual data like $request->all(); but i'm [ ] empty response object on network response tab ( Resource has not content ) and data is empty ???

    public function test(Request $request)
    {

        return $request->all(); // returning blank/empty 

    }

Any ideas on how to fix this issue????

Please sign in or create an account to participate in this conversation.