forked from t3-oss/create-t3-turbo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update Turbo (t3-oss#1172) * update-turbo * update-turbo * fmt --------- Co-authored-by: juliusmarminge <[email protected]> * fix: slice token bearer prefix in invalidate function (t3-oss#1168) * chore(deps): update dependency drizzle-kit to ^0.24.2 (t3-oss#1164) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * revert changes to upstream * revert expo router API routes * use fixed payload version * minor error fixes * add payload oauth collections * fix trpc type * use correct payload layout * Update route.ts * Update route.ts * Update route.ts * Update middleware.ts * Update Accounts.ts * Update Customers.ts * Update Sessions.ts * Update config.ts --------- Co-authored-by: Lacy Morrow <[email protected]> Co-authored-by: juliusmarminge <[email protected]> Co-authored-by: soulful-ramble <[email protected]> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
- Loading branch information
1 parent
439667a
commit 7e35b5b
Showing
64 changed files
with
2,243 additions
and
1,963 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,3 +50,5 @@ dist/ | |
|
||
# turbo | ||
.turbo | ||
|
||
supabase |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { useState } from "react"; | ||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; | ||
import { httpBatchLink, loggerLink } from "@trpc/client"; | ||
import { createTRPCReact } from "@trpc/react-query"; | ||
import superjson from "superjson"; | ||
|
||
import type { AppRouter } from "@acme/api"; | ||
|
||
import { getBaseUrl } from "./base-url"; | ||
import { getToken } from "./session-store"; | ||
|
||
/** | ||
* A set of typesafe hooks for consuming your API. | ||
*/ | ||
export const api = createTRPCReact<AppRouter>(); | ||
export { type RouterInputs, type RouterOutputs } from "@acme/api"; | ||
|
||
/** | ||
* A wrapper for your app that provides the TRPC context. | ||
* Use only in _app.tsx | ||
*/ | ||
export function TRPCProvider(props: { children: React.ReactNode }) { | ||
const [queryClient] = useState(() => new QueryClient()); | ||
const [trpcClient] = useState(() => | ||
api.createClient({ | ||
links: [ | ||
loggerLink({ | ||
enabled: (opts) => | ||
process.env.NODE_ENV === "development" || | ||
(opts.direction === "down" && opts.result instanceof Error), | ||
colorMode: "ansi", | ||
}), | ||
httpBatchLink({ | ||
transformer: superjson, | ||
url: `${getBaseUrl()}/api/trpc`, | ||
headers() { | ||
const headers = new Map<string, string>(); | ||
headers.set("x-trpc-source", "expo-react"); | ||
|
||
const token = getToken(); | ||
if (token) headers.set("Authorization", `Bearer ${token}`); | ||
|
||
return Object.fromEntries(headers); | ||
}, | ||
}), | ||
], | ||
}), | ||
); | ||
|
||
return ( | ||
<api.Provider client={trpcClient} queryClient={queryClient}> | ||
<QueryClientProvider client={queryClient}> | ||
{props.children} | ||
</QueryClientProvider> | ||
</api.Provider> | ||
); | ||
} |
Oops, something went wrong.