mardo
TTCTheo's Typesafe Cult
•Created by rafaelsilva81 on 1/5/2024 in #questions
Syncing data from clerk sign up to database
I call their getUser on the API and then load my database each time they come into my application.
7 replies
TTCTheo's Typesafe Cult
•Created by mardo on 5/14/2023 in #questions
Server Side Rendering
I found createTRPCContext but that takes constructor parameters I dont have access to
3 replies
TTCTheo's Typesafe Cult
•Created by mardo on 5/12/2023 in #questions
infer from trpc calls
I feel like the addressResult shouldnt have that return type, but data of addressResult should
8 replies
TTCTheo's Typesafe Cult
•Created by mardo on 5/12/2023 in #questions
infer from trpc calls
@whatplan does this look right?
export const registrationRouter = createTRPCRouter({
addressLookup: protectedProcedure
.input(z.object({ address: z.string() }))
.query(async ({ input, ctx }) => {
return {
addressResult: async (): Promise<{
reps: Representative[];
sens: Representative[];
}> => {
let r = await new AddressVerificationManager(
process.env.NEXT_GEOCODIO_API_KEY!
).GetAddressAndCongressionalDistrict(input.address);
const districtNumber =
r.results[0]?.fields.congressional_districts[0]?.district_number;
const state = r.results[0]?.address_components.state;
return await getLegislativeDto(districtNumber, state);
},
};
}),
});
8 replies
TTCTheo's Typesafe Cult
•Created by mardo on 5/12/2023 in #questions
infer from trpc calls
was just coming to report back that I didnt have a return type :). Slick shit!! Thank for the reply @whatplan
8 replies