TokyoStarz
TokyoStarz
NNuxt
Created by TokyoStarz on 9/4/2024 in #❓・help
is there a faster building dev version of nuxt generate
Hi all, I’ve recently been playing with embedding a nuxt website into a golang webserver to use it as an overkill ui framework, but since I run my go app with CompileDaemon (an auto rebuild tool for go) having to wait for the site to nuxt generate is getting a bit annoying. I’m just wondering if there’s a way to generate nuxt in a “dev way” where it watches for file changes, and rebuilding in a quick manner but does not host its own web server. I suspect what I have now being probably the only option, but it would be nice to know if something like this exists
7 replies
NNuxt
Created by TokyoStarz on 4/23/2024 in #❓・help
Need help ignoring shiki highlight hints in a copy button
In Nuxt content, you can use Shiki to highlight code blocks, and you can highlight these blocks with nice inlay hints, for example, if I have some javascript code, for example:
const a = 1 + 2;
console.log(a);
const a = 1 + 2;
console.log(a);
and I wanted to highlight the console.log line, I can do this:
const a = 1 + 2;
console.log(a) // [!code hl]
const a = 1 + 2;
console.log(a) // [!code hl]
but if I make a ProseCode component, and add a copy button that uses vue use to copy the string passed through the "code" prop, I get the inlay hint in the copied code. How can I avoid getting the inlay hints without either using regex or ignoring all coments?
2 replies
NNuxt
Created by TokyoStarz on 4/15/2023 in #❓・help
How to catch 401 from server routes and redirect to login page
I have a nuxt 3 app that uses SSR and server routes, it's using a terrible auth solution that I built, it's just a simple session token, but when my session token is invalidated, I get stuck on a 401 page until I delete my sessionToken cookie and refresh, this is because my middleware doesnt look for 401 errors, it only check if the cookie exists:
// middleware/auth.ts
export default defineNuxtRouteMiddleware(() => {
if (!useCookie('sessionToken').value) {
return navigateTo('/login');
}
});
// middleware/auth.ts
export default defineNuxtRouteMiddleware(() => {
if (!useCookie('sessionToken').value) {
return navigateTo('/login');
}
});
How should I redirect a user to the login page if their session token is invalid or doesnt exist?
3 replies
NNuxt
Created by TokyoStarz on 1/7/2023 in #❓・help
websockets on server routes
Hello all, recently I’ve been learning about nuxt 3 server routes by building a simple discord clone, I have a simple server system, messages via dm and in the server, but I want to be able listen to messages on the client, listen for events on the server, and broadcast messages on the server. I haven’t found much of anything working on nuxt3, can anyone offer some help?
2 replies
NNuxt
Created by TokyoStarz on 11/27/2022 in #❓・help
using assets in props
Hi, I want to use images in a component but I want to use assets, example:
<!—component—>
<img :src=“iconSrc” />

<!—index—>
<component iconSrc=“~/icons/icon.svg” />
<!—component—>
<img :src=“iconSrc” />

<!—index—>
<component iconSrc=“~/icons/icon.svg” />
Doesn’t render the image correctly, so how can I use assets in a component?
3 replies