mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
Show privateData only for selected API in dashboard template
This commit is contained in:
5
.changeset/curly-ghosts-tease.md
Normal file
5
.changeset/curly-ghosts-tease.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"create-better-t-stack": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Show privateData only for selected API in dashboard template
|
||||||
@@ -1,17 +1,18 @@
|
|||||||
"use client"
|
"use client"
|
||||||
import { authClient } from "@/lib/auth-client";
|
import { authClient } from "@/lib/auth-client";
|
||||||
{{#if (eq api "orpc")}}
|
{{#if (eq api "orpc")}}
|
||||||
|
import { useQuery } from "@tanstack/react-query";
|
||||||
import { orpc } from "@/utils/orpc";
|
import { orpc } from "@/utils/orpc";
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if (eq api "trpc")}}
|
{{#if (eq api "trpc")}}
|
||||||
|
import { useQuery } from "@tanstack/react-query";
|
||||||
import { trpc } from "@/utils/trpc";
|
import { trpc } from "@/utils/trpc";
|
||||||
{{/if}}
|
{{/if}}
|
||||||
import { useQuery } from "@tanstack/react-query";
|
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
|
|
||||||
export default function Dashboard() {
|
export default function Dashboard() {
|
||||||
const router = useRouter()
|
const router = useRouter();
|
||||||
const { data: session, isPending } = authClient.useSession();
|
const { data: session, isPending } = authClient.useSession();
|
||||||
|
|
||||||
{{#if (eq api "orpc")}}
|
{{#if (eq api "orpc")}}
|
||||||
@@ -35,7 +36,12 @@ export default function Dashboard() {
|
|||||||
<div>
|
<div>
|
||||||
<h1>Dashboard</h1>
|
<h1>Dashboard</h1>
|
||||||
<p>Welcome {session?.user.name}</p>
|
<p>Welcome {session?.user.name}</p>
|
||||||
|
{{#if (eq api "orpc")}}
|
||||||
<p>privateData: {privateData.data?.message}</p>
|
<p>privateData: {privateData.data?.message}</p>
|
||||||
|
{{/if}}
|
||||||
|
{{#if (eq api "trpc")}}
|
||||||
|
<p>privateData: {privateData.data?.message}</p>
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user