Baboluo
Baboluo
Explore posts from servers
TtRPC
Created by Baboluo on 6/10/2023 in #❓-help
Does trpc (t3 stack) disable ssr from Nextjs?
Or is the ssr just not applied to the api
3 replies
TtRPC
Created by Baboluo on 4/27/2023 in #❓-help
How to do an async API call in useEffect (T3 stack)
Hey, I have the router below and want to call the tutorasync in an useCallback function, but the only method that is available is api.chat.queryTutor.useQuery() which is a hook where you add the input in advance. But I have it available only in the useCallbackfunction. is there a way to access the function directly without a hook?
export const chatRouter = createTRPCRouter({
tutor: publicProcedure
.input(
z.object({
messages: z.array(
z.object({
id: z.string(),
text: z.string(),
role: z.enum(["user", "system", "assistant"]),
addToPrompt: z.boolean(),
})
),
})
)
.query(async ({ input }): Promise<ChatMessage> => {
// ...
return {
// ...
}
}),
})
export const chatRouter = createTRPCRouter({
tutor: publicProcedure
.input(
z.object({
messages: z.array(
z.object({
id: z.string(),
text: z.string(),
role: z.enum(["user", "system", "assistant"]),
addToPrompt: z.boolean(),
})
),
})
)
.query(async ({ input }): Promise<ChatMessage> => {
// ...
return {
// ...
}
}),
})
16 replies