mirror of
https://github.com/lukevella/rallly.git
synced 2025-06-14 08:31:53 +02:00
♻️ Update trpcs routes (#531)
This commit is contained in:
parent
d9f6a0d097
commit
18eca7cd8c
32 changed files with 300 additions and 317 deletions
|
@ -5,7 +5,7 @@ import { useMount } from "react-use";
|
|||
|
||||
import { UserSession } from "@/utils/auth";
|
||||
|
||||
import { trpcNext } from "../utils/trpc";
|
||||
import { trpc } from "../utils/trpc";
|
||||
import { useRequiredContext } from "./use-required-context";
|
||||
|
||||
export const UserContext =
|
||||
|
@ -51,12 +51,12 @@ export const IfGuest = (props: { children?: React.ReactNode }) => {
|
|||
export const UserProvider = (props: { children?: React.ReactNode }) => {
|
||||
const { t } = useTranslation("app");
|
||||
|
||||
const queryClient = trpcNext.useContext();
|
||||
const { data: user } = trpcNext.whoami.get.useQuery();
|
||||
const queryClient = trpc.useContext();
|
||||
const { data: user } = trpc.whoami.get.useQuery();
|
||||
|
||||
const [isUpdating, setIsUpdating] = React.useState(false);
|
||||
|
||||
const logout = trpcNext.whoami.destroy.useMutation({
|
||||
const logout = trpc.whoami.destroy.useMutation({
|
||||
onSuccess: async () => {
|
||||
setIsUpdating(true);
|
||||
await queryClient.whoami.invalidate();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue