CodingWithJamal
CodingWithJamal
Explore posts from servers
TtRPC
Created by CodingWithJamal on 10/26/2023 in #❓-help
Disable trpc route cahce?
import { protectedProcedure, router } from "@/lib/trpc/server/trpc";
import { TRPCError } from "@trpc/server";

export const clientRouter = router({
get: protectedProcedure.query(async ({ ctx }) => {
const { id: user_id } = ctx.session.user!;

if (!user_id)
throw new TRPCError({
code: "NOT_FOUND",
message: "No user session found",
});

let { data: client, error } = await ctx.supabase
.from("clients")
.select("*")
.eq("user_id", user_id)
.single();

if (error) {
throw new TRPCError({
code: "BAD_REQUEST",
message: error.message,
});
}

return client;
}),
});
import { protectedProcedure, router } from "@/lib/trpc/server/trpc";
import { TRPCError } from "@trpc/server";

export const clientRouter = router({
get: protectedProcedure.query(async ({ ctx }) => {
const { id: user_id } = ctx.session.user!;

if (!user_id)
throw new TRPCError({
code: "NOT_FOUND",
message: "No user session found",
});

let { data: client, error } = await ctx.supabase
.from("clients")
.select("*")
.eq("user_id", user_id)
.single();

if (error) {
throw new TRPCError({
code: "BAD_REQUEST",
message: error.message,
});
}

return client;
}),
});
I have this code to fetch some data from my db and return it, however if i call the endpoint again, the data is the same even if the db is different? Does trpc cache the old data on new request? If so i dont want this
9 replies
SIASapphire - Imagine a framework
Created by CodingWithJamal on 2/17/2023 in #sapphire-support
How to delete interaction buttons?
Hello
8 replies
SIASapphire - Imagine a framework
Created by CodingWithJamal on 1/21/2023 in #sapphire-support
Formatting Dates
let ratelimit = manager.acquire(interaction.guild.id);

// reply -> String
`Please try again in ${new Date(ratelimit.expires - ratelimit.remainingTime)}`
let ratelimit = manager.acquire(interaction.guild.id);

// reply -> String
`Please try again in ${new Date(ratelimit.expires - ratelimit.remainingTime)}`
How do I format the date properly?
6 replies