My mistake … I obviously misinterpreted your question.
You say in your first question that an plain axios request returns the data from your endpoint and that the API endpoint was set up to be ‘public’ (not requiring authorisation). From my experience, the default is the opposite - i.e. API endpoints are not ‘public’ - and that a plain axios request will fail, just as your second example does.
Could you please explain how you made the API endpoint public, for your first question?
And could you perhaps try the ‘get’ helper code from your first question, now that the API endpoint requires authorisation. I suspect it may now work.