File tree Expand file tree Collapse file tree 3 files changed +12
-5
lines changed
templates/api/orpc/web/astro/src Expand file tree Collapse file tree 3 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -283,12 +283,16 @@ export async function setupEnvironmentVariables(config: ProjectConfig) {
283283 if ( ! ( await fs . pathExists ( serverDir ) ) ) {
284284 return ;
285285 }
286+
286287 const envPath = path . join ( serverDir , ".env" ) ;
287288
288289 let corsOrigin = "http://localhost:3001" ;
289290 if ( hasReactRouter || hasSvelte ) {
290291 corsOrigin = "http://localhost:5173" ;
291292 }
293+ if ( hasAstro ) {
294+ corsOrigin = "http://localhost:4321" ;
295+ }
292296
293297 let databaseUrl : string | null = null ;
294298
Original file line number Diff line number Diff line change 1- import { orpc } from '../lib/orpc';
1+ import { orpc, queryClient } from '../lib/orpc';
22import { useQuery } from '@tanstack/react-query';
33import { QueryClientProvider } from '@tanstack/react-query';
4- import { queryClient } from '../shared/query';
54
65function ApiStatus() {
76 const healthCheck = useQuery(orpc.healthCheck.queryOptions());
Original file line number Diff line number Diff line change 1- import { createORPCClient } from "@orpc/client";
1+ import { createORPCClient, onError } from "@orpc/client";
22import { BatchLinkPlugin } from "@orpc/client/plugins";
33import { RPCLink } from "@orpc/client/fetch";
44import { createTanstackQueryUtils } from "@orpc/tanstack-query";
@@ -14,16 +14,20 @@ export const queryClient = new QueryClient({
1414});
1515
1616export const link = new RPCLink({
17- url: `${import.meta.env.PUBLIC_SERVER_URL }/rpc`,
17+ url: `${import.meta.env.VITE_SERVER_URL }/rpc`,
1818 plugins: [
19- // for request batching optimization
2019 new BatchLinkPlugin({
2120 groups: [{
2221 condition: () => true,
2322 context: {},
2423 }],
2524 }),
2625 ],
26+ interceptors: [
27+ onError((error) => {
28+ console.error(error)
29+ })
30+ ],
2731});
2832
2933export const client: AppRouterClient = createORPCClient(link);
You can’t perform that action at this time.
0 commit comments