amrnn90 / breeze-nuxt

An application / authentication starter kit frontend in Nuxt3 for Laravel Breeze.
MIT License
198 stars 33 forks source link

Preloader when refreshing page #9

Closed pwnz22 closed 1 year ago

pwnz22 commented 1 year ago

Hi, thank you for this composables. I have a problem. When refreshing a page after succes auth, im redirecting to /login first and then to /main route then. I can add some preloader to not see the login page while im authorized.

amrnn90 commented 1 year ago

Hi, are you getting any errors in your browser's console or in Nuxt dev server's console? And which exact Nuxt version are you running?

pwnz22 commented 1 year ago

No, there is no any errors, Nuxt version is 3.3.2

upd: Uhh, if i do auth.client.ts im getting this behavior. With ssr: false working, what if i need ssr?)

pwnz22 commented 1 year ago

Getting something like this in terminal

FetchError: fetch failed (http://localhost:8000/api/user)                                                                                     16:58:14
    at async $fetchRaw2 (file:///Users/valijon/Documents/Sites/lk-new/node_modules/ofetch/dist/shared/ofetch.502a4799.mjs:180:24)
    at async Module.$larafetch (/Users/valijon/Documents/Sites/lk-new/utils/$larafetch.ts:34:12)
    at async Module.fetchCurrentUser (/Users/valijon/Documents/Sites/lk-new/composables/useAuth.ts:74:12)
    at async /Users/valijon/Documents/Sites/lk-new/plugins/auth.ts:11:126
    at async Object.callAsync (file:///Users/valijon/Documents/Sites/lk-new/node_modules/unctx/dist/index.mjs:53:16)
    at async applyPlugin (/Users/valijon/Documents/Sites/lk-new/node_modules/nuxt/dist/app/nuxt.js:121:23)
    at async Module.applyPlugins (/Users/valijon/Documents/Sites/lk-new/node_modules/nuxt/dist/app/nuxt.js:131:5)
    at async createNuxtAppServer (/Users/valijon/Documents/Sites/lk-new/node_modules/nuxt/dist/app/entry.js:29:7)
    at async default (file:///Users/valijon/Documents/Sites/lk-new/node_modules/@nuxt/vite-builder/dist/runtime/vite-node.mjs:27:18)
    at async Object.renderToString (file:///Users/valijon/Documents/Sites/lk-new/node_modules/vue-bundle-renderer/dist/runtime.mjs:176:19)
amrnn90 commented 1 year ago

I guess this is the same as issue #3 Try following the instructions in this comment and see if it fixes your problem.