ethan!
ethan!
Explore posts from servers
NNuxt
Created by ethan! on 12/15/2024 in #❓・help
top level await
why cant i use top level await in server middleware
15 replies
NNuxt
Created by ethan! on 12/15/2024 in #❓・help
hydration error
<NuxtLink :to="isAuth() ? '/servers' : '/api/auth'" :external="!isAuth()">
<Button class="w-52 h-14 text-lg" variant="secondary">
<Icon name="mdi:view-dashboard" size="25px" />
Dashboard
</Button>
</NuxtLink>
<NuxtLink :to="isAuth() ? '/servers' : '/api/auth'" :external="!isAuth()">
<Button class="w-52 h-14 text-lg" variant="secondary">
<Icon name="mdi:view-dashboard" size="25px" />
Dashboard
</Button>
</NuxtLink>
[Vue warn]: Hydration attribute mismatch on <a href=​"/​api/​auth">​…​</a>​
- rendered on server: href="/api/auth"
- expected on client: href="/servers"
Note: this mismatch is check-only. The DOM will not be rectified in production due to performance overhead.
You should fix the source of the mismatch.
at <RouterLink ref=fn to="/servers" activeClass=undefined ... >
at <NuxtLink to="/servers" external=false >
at <Index onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< undefined > >
at <Anonymous key="/" vnode= {__v_isVNode: true, __v_skip: true, type: {…}, props: {…}, key: null, …} route= {fullPath: '/', hash: '', query: {…}, name: 'index', path: '/', …} ... >
at <RouterView name=undefined route=undefined >
at <NuxtPage>
at <Default ref=Ref< undefined > >
at <AsyncComponentWrapper ref=Ref< undefined > >
at <LayoutLoader key="default" layoutProps= {ref: RefImpl} name="default" >
at <NuxtLayoutProvider layoutProps= {ref: RefImpl} key="default" name="default" ... >
at <NuxtLayout>
at <App key=4 >
at <NuxtRoot>
[Vue warn]: Hydration attribute mismatch on <a href=​"/​api/​auth">​…​</a>​
- rendered on server: href="/api/auth"
- expected on client: href="/servers"
Note: this mismatch is check-only. The DOM will not be rectified in production due to performance overhead.
You should fix the source of the mismatch.
at <RouterLink ref=fn to="/servers" activeClass=undefined ... >
at <NuxtLink to="/servers" external=false >
at <Index onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< undefined > >
at <Anonymous key="/" vnode= {__v_isVNode: true, __v_skip: true, type: {…}, props: {…}, key: null, …} route= {fullPath: '/', hash: '', query: {…}, name: 'index', path: '/', …} ... >
at <RouterView name=undefined route=undefined >
at <NuxtPage>
at <Default ref=Ref< undefined > >
at <AsyncComponentWrapper ref=Ref< undefined > >
at <LayoutLoader key="default" layoutProps= {ref: RefImpl} name="default" >
at <NuxtLayoutProvider layoutProps= {ref: RefImpl} key="default" name="default" ... >
at <NuxtLayout>
at <App key=4 >
at <NuxtRoot>
im getting this error as isAuth() starts as false then goes to true
10 replies
NNuxt
Created by ethan! on 12/15/2024 in #❓・help
data fetching
onMouted fetches every time i reroute to the main page but i only want it to run every time you reload any page
15 replies
NNuxt
Created by ethan! on 12/15/2024 in #❓・help
useFetch
why does useFetch not fetch my data from my nuxt api but $fetch does?
const fetchUser = async () => {
const { data: userData } = await useFetch<CustomUser | null>("/api/auth/status", { headers });
console.log(userData.value);
user.value = userData.value;

return user.value;
};
const fetchUser = async () => {
const { data: userData } = await useFetch<CustomUser | null>("/api/auth/status", { headers });
console.log(userData.value);
user.value = userData.value;

return user.value;
};
it just returns null every time but when i visit it myself, it works fine. useFetch isn't even hitting my api
5 replies
NNuxt
Created by ethan! on 12/12/2024 in #❓・help
404
How do I make a custom 404 page?
15 replies
NNuxt
Created by ethan! on 12/7/2024 in #❓・help
srcDir: "src/"
I added srcDir: "src/", to my nuxt config, but now auto imports are broke
5 replies
NNuxt
Created by ethan! on 12/7/2024 in #❓・help
Shorthand
How do I use shorthand to reference the .nuxt/ folder?
8 replies
VVALORANT
Created by ethan! on 7/6/2024 in #community-help
No team VC
I have no team VC, any ideas?
1 replies
NNuxt
Created by ethan! on 6/28/2024 in #❓・help
API route called multiple times
I have a page which calls an API route once:
const { data: guilds } = useFetch("/api/discord/guilds");
const { data: guilds } = useFetch("/api/discord/guilds");
However on the server side it's logging as three separate requests. This is bad because in my server I'm calling an external API and it's getting me ratelimited. Any ideas how to only call my API once?
15 replies
NNuxt
Created by ethan! on 6/25/2024 in #❓・help
Buffer is not defined
Buffer is not defined

at http://localhost:3000/_nuxt/@fs/C:/Users/ethan/Desktop/Projects/watchdog/website/node_modules/.cache/vite/client/deps/postgres.js?v=9ecbf21c:617:14
Buffer is not defined

at http://localhost:3000/_nuxt/@fs/C:/Users/ethan/Desktop/Projects/watchdog/website/node_modules/.cache/vite/client/deps/postgres.js?v=9ecbf21c:617:14
20 replies
NNuxt
Created by ethan! on 6/23/2024 in #❓・help
Pages directory
If i want to create a page specific component do i have to use the components folder? like there's no way to create the component in the pages directory with the page itself
19 replies
NNuxt
Created by ethan! on 6/23/2024 in #❓・help
eslint file not checking itself
How do I make my eslint.config.mjs file check for eslint erorrs in its own file?
1 replies
DTDrizzle Team
Created by ethan! on 5/27/2024 in #help
Enums
const validStatuses = ["claimed", "confirmed", "started"] as const;
const statusEnum = pgEnum("status", validStatuses);
export type SessionStatus = typeof validStatuses[number];

export const trainingsTable = pgTable("training", {
date: text("date").primaryKey(),
host: text("host").notNull(),
status: statusEnum("status").notNull(),
notificationID: text("notification_id"),
notificationDeletionDate: timestamp("notification_deletion_date")
});
const validStatuses = ["claimed", "confirmed", "started"] as const;
const statusEnum = pgEnum("status", validStatuses);
export type SessionStatus = typeof validStatuses[number];

export const trainingsTable = pgTable("training", {
date: text("date").primaryKey(),
host: text("host").notNull(),
status: statusEnum("status").notNull(),
notificationID: text("notification_id"),
notificationDeletionDate: timestamp("notification_deletion_date")
});
When I run drizzle-kit push --config=src/db/config.ts it returns error: type "status" does not exist, how do I fix this?
9 replies
DTDrizzle Team
Created by ethan! on 5/9/2024 in #help
CUUID
is there functionality for cuuid instead of just uuid?
1 replies
DTDrizzle Team
Created by ethan! on 4/28/2024 in #help
Issue with JSON + TypScript
Here's my code:
.findFirst({ where: eq(globalBans.offender.id, userID) });
.findFirst({ where: eq(globalBans.offender.id, userID) });
Here's my schema:
interface GlobalBanUser {
id: string;
username: string;
avatar: string;
};

export const globalBans = pgTable("global_bans", {
offender: json("offender").notNull().$type<GlobalBanUser>(),
reason: text("reason").notNull(),
evidence: json("evidence").notNull().$type<string[]>(),
moderator: json("moderator").notNull().$type<GlobalBanUser>(),
notes: text("notes").notNull(),
date: timestamp("date", { mode: "date" }).defaultNow()
});
interface GlobalBanUser {
id: string;
username: string;
avatar: string;
};

export const globalBans = pgTable("global_bans", {
offender: json("offender").notNull().$type<GlobalBanUser>(),
reason: text("reason").notNull(),
evidence: json("evidence").notNull().$type<string[]>(),
moderator: json("moderator").notNull().$type<GlobalBanUser>(),
notes: text("notes").notNull(),
date: timestamp("date", { mode: "date" }).defaultNow()
});
Here's my error:
Property 'id' does not exist on type 'PgColumn<{ name: "offender"; tableName: "global_bans"; dataType: "json"; columnType: "PgJson"; data: GlobalBanUser; driverParam: unknown; notNull: true; hasDefault: false; enumValues: undefined; baseColumn: never; }, {}, {}>'.
Property 'id' does not exist on type 'PgColumn<{ name: "offender"; tableName: "global_bans"; dataType: "json"; columnType: "PgJson"; data: GlobalBanUser; driverParam: unknown; notNull: true; hasDefault: false; enumValues: undefined; baseColumn: never; }, {}, {}>'.
2 replies