How do I return a plain text in trpc?
I want to return an ‘ok’ directly in the return data, not {result:{data: ‘xxx’}}
5 Replies
I'm using the v11 version.
@Bytes just out of complete curiosity, what are you looking to achieve? Why specifically do you need to return 'ok' versus say {success: true}
Is it like a specific api/endpoint that you need to return 'OK' to? Or that a service is checking for?
Yes, for example, I'm using the library siwe, which needs to return a plain text nonce value, and I can't seem to change the return type of that!
There is no solution in tRPC for that
You’d might be able to do it by ending the response yourself with a procedure, but you’d probably end up crashing tRPC
You’d have to experiment
@Bytes have you seen this by any chance? https://github.com/codingwithmanny/trpc-siwe-monorepo
just had a quick search and came across it, i don’t know the exact auth flow but I imagine this is somewhat similar to what you’re trying to achieve no?
GitHub
GitHub - codingwithmanny/trpc-siwe-monorepo
Contribute to codingwithmanny/trpc-siwe-monorepo development by creating an account on GitHub.