salomon_.
salomon_.
Explore posts from servers
NNuxt
Created by salomon_. on 3/26/2025 in #❓・help
Is there rewrites in middleware?
So nuxt miss this feature?
10 replies
NNuxt
Created by salomon_. on 3/26/2025 in #❓・help
Is there rewrites in middleware?
Hi, how would you do it? I couldn't find rewrites in nitro docs too. In nextjs for example, I did this with NextResponse.rewrite. Basically what I need to do is: the url should be website.com/:country/:region/:city but it should match pages/hotels/[...slug].vue component (route). Is that possible?
10 replies
NNuxt
Created by salomon_. on 3/23/2025 in #❓・help
Fetch only once on initial page load
@kapa.ai is it possible to avoid fetch on client side? import type { HeroSlide } from './types'; export const getHeroSliders = () => { return useAsyncData<{ data: HeroSlide[] }>( hero-sliders, () => useNuxtApp().$apiFetch('/sliders'), { lazy: true, server: true, }, ); };
20 replies
NNuxt
Created by salomon_. on 3/23/2025 in #❓・help
Fetch only once on initial page load
@kapa.ai I need to fetch data for hero section on server side and refetch data on locale change but also cache data between pages
import type { HeroSlide } from './types';

export const getHeroSliders = () => {
const locale = useCookie('i18n_redirected');
const nuxtApp = useNuxtApp();

return useAsyncData<{ data: HeroSlide[] }>(`hero-sliders`, () => nuxtApp.$apiFetch('/sliders'), {
watch: [locale],
// lazy: true,
server: true,
getCachedData: (key) => {
return nuxtApp.payload.data[key] || nuxtApp.static.data[key];
},
});
};
import type { HeroSlide } from './types';

export const getHeroSliders = () => {
const locale = useCookie('i18n_redirected');
const nuxtApp = useNuxtApp();

return useAsyncData<{ data: HeroSlide[] }>(`hero-sliders`, () => nuxtApp.$apiFetch('/sliders'), {
watch: [locale],
// lazy: true,
server: true,
getCachedData: (key) => {
return nuxtApp.payload.data[key] || nuxtApp.static.data[key];
},
});
};
and on page where get data
const { data: heroSliders } = await getHeroSliders();
const { data: heroSliders } = await getHeroSliders();
but nuxt loading indicator always shows on locale change and data is not change for new locale
20 replies
NNuxt
Created by salomon_. on 3/23/2025 in #❓・help
Fetch only once on initial page load
@kapa.ai but I already use key 'global-settings' and it still refetch it on the client side on navigation
import type { Settings } from './types';

export const getSettings = () => {
// We call this api method in app.vue which is not re-render on locale switch
// so we manually watch changing this cookie to trigger re-fetch with new locale
const locale = useCookie('i18n_redirected');
return useAsyncData<{ data: { settings: Settings } }>(
'global-settings',
() => useNuxtApp().$apiFetch('/settings'),
{
watch: [locale],
lazy: true,
server: true,
},
);
};
import type { Settings } from './types';

export const getSettings = () => {
// We call this api method in app.vue which is not re-render on locale switch
// so we manually watch changing this cookie to trigger re-fetch with new locale
const locale = useCookie('i18n_redirected');
return useAsyncData<{ data: { settings: Settings } }>(
'global-settings',
() => useNuxtApp().$apiFetch('/settings'),
{
watch: [locale],
lazy: true,
server: true,
},
);
};
20 replies
DTDrizzle Team
Created by veeque on 1/21/2025 in #help
What is the recommended way to have a staging and a production environment?
And just run drizzle.config for different environment
4 replies
DTDrizzle Team
Created by veeque on 1/21/2025 in #help
What is the recommended way to have a staging and a production environment?
4 replies
DTDrizzle Team
Created by veeque on 1/21/2025 in #help
What is the recommended way to have a staging and a production environment?
4 replies
NNuxt
Created by salomon_. on 9/10/2024 in #❓・help
Cannot render HTML string comes from external API
thank you
3 replies
NNuxt
Created by salomon_. on 5/31/2024 in #❓・help
Server side fetch refetches on client 3 times
So there is no way in nuxt to fetch some data here and there and it auto deduped repeatable calls? Like in tanstack query? So I should fetch it on top and pass through 5+ components?
7 replies
NNuxt
Created by salomon_. on 5/31/2024 in #❓・help
Server side fetch refetches on client 3 times
Anyone?
7 replies
NNuxt
Created by salomon_. on 5/28/2024 in #❓・help
How to manage 'remote' localization
@Anjjar but usually locale data stored in json files and then utilize by i18n module, how it will be in my case?
5 replies
NNuxt
Created by FoxCode on 3/10/2023 in #❓・help
Reduce unused javascript (nuxt)
Will that affect only bundling? Component still be server side rendered, right?
30 replies
DTDrizzle Team
Created by 균어 on 3/5/2024 in #help
How to get findMany with count?
Hey, did you find a solution? Have same question
9 replies
NNuxt
Created by salomon_. on 11/25/2022 in #❓・help
Correct way to get cookie from the rest api
@rohrig Let me explain a bit. So, now I have a dashboard built with django as a rest api and vue 3 (spa) on frontend side. I have a static auth pages, login, signup, etc served by django so it generates and pass token and session to the client. The index.html of spa app is also served by django so I always have the csrftoken to do a rest api like post etc. So I have a kinda hybrid app where we use static django pages for login and then redirect to the spa. But now I need to ged rid of the static pages. So looking for a way to do an auth flow
17 replies
NNuxt
Created by salomon_. on 11/25/2022 in #❓・help
Correct way to get cookie from the rest api
@rohrig where should I get csrftoken in this case?
17 replies
NNuxt
Created by salomon_. on 11/25/2022 in #❓・help
Correct way to get cookie from the rest api
@rohrig The CSRF token is generated on backend side (Django) so I need to get it from there to be able to work with the rest api. Thanks for the links, I will check it out.
17 replies
NNuxt
Created by salomon_. on 11/25/2022 in #❓・help
Correct way to get cookie from the rest api
@Zampa I don't think this is an answer to my initial question. Your message showing how to get cookie on server side, but I am asking how to get cookie from backend rest api and send it to the user. Thank you anyway. Still looking for a solution🥹
17 replies