'antonyyprints'
'antonyyprints'
Explore posts from servers
TTCTheo's Typesafe Cult
Created by 'antonyyprints' on 2/1/2024 in #questions
Running script from root
No description
3 replies
TTCTheo's Typesafe Cult
Created by 'antonyyprints' on 11/6/2023 in #questions
tRPC not returning string
I have a procedure that generates a presigned url and sends it to the frontend. When I print the url in the trpc procedure it prints, but when I try to print it on the frontend, it doesn't. Clientside
const Camera = () => {

const [image, setImage] = useState(null);
const mutation = api.media.postImage.useMutation();

...
const pickImage = async () => {
...
const url = mutation.mutate({bucket: "myawsbucket-0xc3", key: "testKey123", caption: "test caption", tags: ["otherUserKey"]});
console.log("url on frontend: ", url);
};

return (
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
<Button title="Pick an image from camera roll" onPress={pickImage} />
{image && <Image source={{ uri: image }} style={{ width: 200, height: 200 }} />}
</View>
);
}
export default Camera;
const Camera = () => {

const [image, setImage] = useState(null);
const mutation = api.media.postImage.useMutation();

...
const pickImage = async () => {
...
const url = mutation.mutate({bucket: "myawsbucket-0xc3", key: "testKey123", caption: "test caption", tags: ["otherUserKey"]});
console.log("url on frontend: ", url);
};

return (
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
<Button title="Pick an image from camera roll" onPress={pickImage} />
{image && <Image source={{ uri: image }} style={{ width: 200, height: 200 }} />}
</View>
);
}
export default Camera;
tRPC
postImage: protectedProcedure
.input(
z.object({
bucket: z.string(),
key: z.string(),
caption: z.string().optional(),
tags: z.array(z.string()),
}),
)
.output(z.string())
.mutation(async ({ ctx, input }) => {
const metadata = {
AuthorId: ctx.session.uid,
};
if (input.caption) {
metadata["Caption" as keyof typeof metadata] = input.caption;
}

if (input.tags.length > 0) {
input.tags.forEach((tag, index) => {
metadata[`Tag${index}` as keyof typeof metadata] = tag;
});
}

const putObjectParams = {
Bucket: input.bucket,
Key: input.key,
Metadata: metadata,
};

const url = await getSignedUrl(ctx.s3, new PutObjectCommand(putObjectParams), {
expiresIn: 3600,
});
console.log("url", url);
return url;
}),
postImage: protectedProcedure
.input(
z.object({
bucket: z.string(),
key: z.string(),
caption: z.string().optional(),
tags: z.array(z.string()),
}),
)
.output(z.string())
.mutation(async ({ ctx, input }) => {
const metadata = {
AuthorId: ctx.session.uid,
};
if (input.caption) {
metadata["Caption" as keyof typeof metadata] = input.caption;
}

if (input.tags.length > 0) {
input.tags.forEach((tag, index) => {
metadata[`Tag${index}` as keyof typeof metadata] = tag;
});
}

const putObjectParams = {
Bucket: input.bucket,
Key: input.key,
Metadata: metadata,
};

const url = await getSignedUrl(ctx.s3, new PutObjectCommand(putObjectParams), {
expiresIn: 3600,
});
console.log("url", url);
return url;
}),
2 replies
TTCTheo's Typesafe Cult
Created by 'antonyyprints' on 10/2/2023 in #questions
s3 type error
No description
6 replies
TTCTheo's Typesafe Cult
Created by 'antonyyprints' on 9/15/2023 in #questions
NextAuth Discord Provider Callback Error
No description
2 replies
TTCTheo's Typesafe Cult
Created by 'antonyyprints' on 9/5/2023 in #questions
discord callback url
No description
24 replies
TTCTheo's Typesafe Cult
Created by 'antonyyprints' on 8/31/2023 in #questions
Discord not signing in
No description
9 replies
TTCTheo's Typesafe Cult
Created by 'antonyyprints' on 3/19/2023 in #questions
Google Provider when deploying
I'm trying to deploy my project on vercel with a custom domain, but I'm getting an error that says something like: Google OAuth 2 authorization - Error: redirect_uri_mismatch. does anyone know how to fix this?
4 replies
TTCTheo's Typesafe Cult
Created by 'antonyyprints' on 2/18/2023 in #questions
mutation is returning void
27 replies
TTCTheo's Typesafe Cult
Created by 'antonyyprints' on 2/16/2023 in #questions
Yo gangster my is my optimistic ui update look funny
3 replies
TTCTheo's Typesafe Cult
Created by 'antonyyprints' on 2/11/2023 in #questions
should I use ctx or api?
No description
14 replies
TTCTheo's Typesafe Cult
Created by 'antonyyprints' on 2/10/2023 in #questions
I'm trying to change the image in my img tag (html tag not next component), but it's saying module n
4 replies
TTCTheo's Typesafe Cult
Created by 'antonyyprints' on 2/8/2023 in #questions
Tailwind component I copy and pasted is buggin
8 replies
TTCTheo's Typesafe Cult
Created by 'antonyyprints' on 2/8/2023 in #questions
what are the backgrounds like the one ping.gg uses called
I need answer, very urgent thank you
11 replies
TTCTheo's Typesafe Cult
Created by 'antonyyprints' on 1/26/2023 in #questions
trying to add role based authentication
49 replies
TTCTheo's Typesafe Cult
Created by 'antonyyprints' on 1/25/2023 in #questions
adding provider causes type error
22 replies
TTCTheo's Typesafe Cult
Created by 'antonyyprints' on 12/29/2022 in #questions
Quick question on concept
does the implementation of TRPC replace getStaticProps in nextjs. getStaticProps. I just havn't seen getStaticProps anywhere in the example T3 stack project. "Essentially, getStaticProps allows you to tell Next.js: “Hey, this page has some data dependencies — so when you pre-render this page at build time, make sure to resolve them first!”".
4 replies