🇵🇸 Prince Toast
🇵🇸 Prince Toast
Explore posts from servers
TtRPC
Created by 🇵🇸 Prince Toast on 12/20/2023 in #❓-help
I can't mutate or query in SvelteKit
Environment: Node 20 with Yarn I'm not getting any specific errors but I don't get the "mutate" or "query" methods with trpc client in SvelteKit. Here is the situation: My API is written in Fastify. I'm using the Fastify adapter for tRPC. On the client, I get autocompletion for the routers (like user.createAccount or post.getAll) but I don't get the ability to mutate or query data.
// api.ts file in lib folder
import { createTRPCProxyClient, httpBatchLink } from '@trpc/client';
import type { AppRouter } from '../../../backend/src/router';

export const api = createTRPCProxyClient<AppRouter>({
links: [
httpBatchLink({
url: 'http://localhost:5173/api',
// You can pass any HTTP headers you wish here
async headers() {
return {
authorization: (localStorage.getItem('token')
? localStorage.getItem('token')
: '') as string
};
}
})
]
});
// api.ts file in lib folder
import { createTRPCProxyClient, httpBatchLink } from '@trpc/client';
import type { AppRouter } from '../../../backend/src/router';

export const api = createTRPCProxyClient<AppRouter>({
links: [
httpBatchLink({
url: 'http://localhost:5173/api',
// You can pass any HTTP headers you wish here
async headers() {
return {
authorization: (localStorage.getItem('token')
? localStorage.getItem('token')
: '') as string
};
}
})
]
});
2 replies
TTCTheo's Typesafe Cult
Created by 🇵🇸 Prince Toast on 8/30/2023 in #questions
How to stop a div using 100% height from growing within a flex container
I have a flex container with two divs, one has a fixed height and the other one has 100% height (h-full). I need it so that the div with full height becomes scrollable if it overflows instead of growing but for some reason it always grows to a limit (which for some reason seems like 100vh, 🤷‍♂️). I need it so that it doesn't extend beyond it's initial height if it doesn't overflow.
8 replies
TTCTheo's Typesafe Cult
Created by 🇵🇸 Prince Toast on 8/17/2023 in #questions
Getting user data given their ID on Clerk
How do I get user info using their ID on Clerk? I'm using NextJS pages router.
5 replies
TTCTheo's Typesafe Cult
Created by 🇵🇸 Prince Toast on 8/15/2023 in #questions
React refs keep telling me ref.current.value does not exist on type 'never'
No description
17 replies
TTCTheo's Typesafe Cult
Created by 🇵🇸 Prince Toast on 8/6/2023 in #questions
How to store and retrieve many-to-one records in a table of "messages" given a "server".
The "messages" and "server" are just analogies of the situation. Suppose we have a "servers" table and "messages" table where each server has certain messages in the messages table. How would I be able to efficiently store each server's messages in a way that would make it easier and faster to retrieve it in the future instead of having to go through the whole table (which would be done if I used "where") in order to retrieve the necessary messages?
3 replies