Single
Single
NNuxt
Created by Zeeeth on 10/1/2024 in #❓・help
Add data to store on Page Refresh
Apparently, afterRestore has been renamed to afterHydrate in the latest version
8 replies
NNuxt
Created by Zeeeth on 10/1/2024 in #❓・help
Add data to store on Page Refresh
8 replies
NNuxt
Created by Zeeeth on 10/1/2024 in #❓・help
Add data to store on Page Refresh
We solve this by using pinia-plugin-persistedstate. It saves the token to the sessionStoreage / localStorage and loads it for you automatically. It has a callback method you can use to request the user for the token from the backend once the store is loaded:
...},
persist: {
afterRestore: async ctx => {
const u = await loadYourUser(ctx.store.token)
}
}
...},
persist: {
afterRestore: async ctx => {
const u = await loadYourUser(ctx.store.token)
}
}
8 replies
NNuxt
Created by herbst🌵 on 8/21/2024 in #❓・help
Can't get relative paths in `nuxi generate`
It's hard to say without seeing your code. Your reproduction does exactly what it is supposed to do. ./ => /, thats why only . results into relative paths which might work better depending on your provider. I can't tell why this breaks your subpages without seeing the issue.
13 replies
NNuxt
Created by herbst🌵 on 8/21/2024 in #❓・help
Can't get relative paths in `nuxi generate`
It seems to be related to your hosting provider.
13 replies
NNuxt
Created by herbst🌵 on 8/21/2024 in #❓・help
Can't get relative paths in `nuxi generate`
Yeah that doesn't sound to be nuxt related anymore.
13 replies
NNuxt
Created by herbst🌵 on 8/21/2024 in #❓・help
Can't get relative paths in `nuxi generate`
You have to use a dot only (without slashes) as baseUrl.
13 replies
NNuxt
Created by jd on 8/20/2024 in #❓・help
Docker and Nuxt in production
You need to expose something. If you do not want to expose the API directly, you can use nitro (nuxt-server) as a proxy. In this case, "only" the server has to be exposed but not the api directly. Does this make sense? I guess not.
7 replies
NNuxt
Created by Futuro on 8/19/2024 in #❓・help
I lose my query params on page load
This can happen if you use a reverse-proxy like Cloudflare with a page-redirect-rule that does drop query strings. Is this happening locally too?
4 replies
NNuxt
Created by jd on 8/20/2024 in #❓・help
Docker and Nuxt in production
What we do is, we use a reverse-proxy like https://traefik.io/traefik/ to give managed access to the API and thus expose it to the public.
7 replies
NNuxt
Created by jd on 8/20/2024 in #❓・help
Docker and Nuxt in production
You simply can't. The API call is not being made by the Webserver that is hosting the SSG/Frontend, but the Client (Browser) that visits the site. If this client has no access to the (exposed) API, you can't not do requests against it.
7 replies
NNuxt
Created by Maciej on 8/20/2024 in #❓・help
<NuxtPage> events?
It feels indeed weird to do that. It might not show errors as the recipient does care if the component ever emits an event called some-event but you will have a very hard time to debug this in the future. I'd say for a quick'n dirty page, okay. In general i would not do that.
4 replies
NNuxt
Created by ZaKk on 8/11/2024 in #❓・help
api 404
As Alex said, if you generate your page. No server is being generated. It is creating a Single Page Application - no backend = no server thus the 404's. You started the server 'manually' on your local machine thus the API was available, this doesn't count for production. You must use npm run build instead of generate and deploy the server (somewhere).
44 replies
NNuxt
Created by hz2222 on 8/5/2024 in #❓・help
ogImage is not visible
You can debug it without a cache in place using: https://www.opengraph.xyz/
5 replies
NNuxt
Created by martine on 8/5/2024 in #❓・help
meta tags previews not displaying with ssr: false and nuxt generate
Yepp, useSeoMeta is the way to go
3 replies
NNuxt
Created by Ulrich on 8/5/2024 in #❓・help
Multiple Alias and Route navigation in Nuxt 3
You can inject the different behaviours using a prop.
3 replies
NNuxt
Created by Ulrich on 8/5/2024 in #❓・help
Multiple Alias and Route navigation in Nuxt 3
I would create those pages and make the content from /search a Component that you re-use on all of those pages.
3 replies