Viridian
Viridian
Explore posts from servers
TtRPC
Created by Viridian on 9/13/2023 in #❓-help
TS(2742) error when trying to create client
I fixed it
16 replies
TtRPC
Created by Viridian on 9/13/2023 in #❓-help
TS(2742) error when trying to create client
I get Cannot GET /character.get
16 replies
TtRPC
Created by Viridian on 9/13/2023 in #❓-help
TS(2742) error when trying to create client
Gives me a 404 for some odd reason; and it does character.get?batch=1&input={} on the front-end while on panel it does character.get?batch=1&input={"0": {}}. Not sure if that matters
16 replies
TtRPC
Created by Viridian on 9/13/2023 in #❓-help
TS(2742) error when trying to create client
For some reason the call works fine when I do it via TRPCPanel, but not from my front-end to the backend
16 replies
TtRPC
Created by Viridian on 9/13/2023 in #❓-help
TS(2742) error when trying to create client
@functiondj I managed to fix this, but I'm getting another strange issue now
16 replies
TtRPC
Created by Viridian on 9/13/2023 in #❓-help
TS(2742) error when trying to create client
Not sure what's causing it
16 replies
TtRPC
Created by Viridian on 9/13/2023 in #❓-help
TS(2742) error when trying to create client
And here's the code snippet in client for creating the client:
import { createTRPCProxyClient, httpBatchLink } from "@trpc/client";
import type { AppRouter } from "../../../server/src/api";

const client = createTRPCProxyClient<AppRouter>({
links: [
httpBatchLink({
url: 'http://localhost:8000/',
})
]
})

client.character.get.query()

export default client
import { createTRPCProxyClient, httpBatchLink } from "@trpc/client";
import type { AppRouter } from "../../../server/src/api";

const client = createTRPCProxyClient<AppRouter>({
links: [
httpBatchLink({
url: 'http://localhost:8000/',
})
]
})

client.character.get.query()

export default client
16 replies
TtRPC
Created by Viridian on 9/13/2023 in #❓-help
TS(2742) error when trying to create client
This is in server
16 replies
TtRPC
Created by Viridian on 9/13/2023 in #❓-help
TS(2742) error when trying to create client
import { initTRPC } from '@trpc/server';
import { Context } from './context';
import { createCharacterRouter } from './character/router';
import { createSteamIdRouter } from './steamId/router';


export const createRouter = () => {
const t = initTRPC.context<Context>().create();

const router = t.router({
character: createCharacterRouter(t),
steamId: createSteamIdRouter(t),
});

return router;
};
import { initTRPC } from '@trpc/server';
import { Context } from './context';
import { createCharacterRouter } from './character/router';
import { createSteamIdRouter } from './steamId/router';


export const createRouter = () => {
const t = initTRPC.context<Context>().create();

const router = t.router({
character: createCharacterRouter(t),
steamId: createSteamIdRouter(t),
});

return router;
};
16 replies
TtRPC
Created by Viridian on 9/13/2023 in #❓-help
TS(2742) error when trying to create client
Let me see;
16 replies