laravel-enso/core

api/meta return spurious '<'

wbovela opened this issue · 1 comments

This is a bug.

Prerequisites

  • Are you running the latest version?
  • Are you reporting to the correct repository?
  • Did you check the documentation?
  • Did you perform a cursory search?

Description

At application boot the api/meta call returns the GuestState array (meta, i18n, routes). It is preceded by a '<' character causing an error in store.js:
"const coreActions = {
loadGuestState({ commit }) {
axios.get('/api/meta', {
params: { locale: localStorage.getItem('locale') },
}).then(({ data }) => {
const { meta, i18n, routes } = data;
const lang = Object.keys(i18n).shift(); <--- error!
commit('localisation/setI18n', i18n);
commit('preferences/lang', lang);
commit('setMeta', meta);
commit('setRoutes', routes);
commit('guestState', true);
});"

Here's the response from the GET to http://homestead.oxygen4/api/meta:

<{"meta":{"appName":"Oxygen4","appUrl":"http://homestead.oxygen4/","extendedDocumentTitle":false,"showQuote":false},"i18n":{"en":{"Email":"Email","Password":"Password","Remember me":"Remember me","Forgot password":"Forgot password","Login":"Login","Send a reset password link":"Send a reset password link","Repeat Password":"Repeat Password","Success":"Success","Error":"Error"}},"routes":{"login":{"uri":"api/login","methods":["POST"],"domain":null},"password.email":{"uri":"api/password/email","methods":["POST"],"domain":null},"password.reset":{"uri":"api/password/reset","methods":["POST"],"domain":null}}}

Steps to Reproduce

Start the application

Expected behavior

Login form to show

Actual behavior

An error occurs:
store.js?5fb9:66 Uncaught (in promise) TypeError: Cannot convert undefined or null to object
at Function.keys ()
at eval (store.js?5fb9:66)

Found a rogue '<' in our own code.