Skip to content

Commit 1cc09a6

Browse files
fix(cli): add @prisma/client in web for all backends and use auth.api in nextjs for both self and separate backends
1 parent 08deb2e commit 1cc09a6

File tree

3 files changed

+7
-52
lines changed

3 files changed

+7
-52
lines changed

apps/cli/src/helpers/core/db-setup.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,12 @@ export async function setupDatabase(
6464
});
6565
}
6666

67-
// workaround
68-
if (backend === "self") {
69-
const webDir = path.join(projectDir, "apps/web");
70-
if (await fs.pathExists(webDir)) {
71-
await addPackageDependency({
72-
dependencies: ["@prisma/client"],
73-
projectDir: webDir,
74-
});
75-
}
67+
const webDir = path.join(projectDir, "apps/web");
68+
if (await fs.pathExists(webDir)) {
69+
await addPackageDependency({
70+
dependencies: ["@prisma/client"],
71+
projectDir: webDir,
72+
});
7673
}
7774
} else if (orm === "drizzle") {
7875
if (database === "sqlite") {

apps/cli/src/helpers/database-providers/prisma-postgres-setup.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ async function setupWithCreateDb(
4040
orm: ORM,
4141
) {
4242
try {
43-
log.info(
44-
"Starting Prisma Postgres setup with create-db. Please follow the instructions below:",
45-
);
43+
log.info("Starting Prisma Postgres setup with create-db.");
4644

4745
const selectedRegion = await select({
4846
message: "Select your preferred region:",
Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{{#if (eq backend "self")}}
21
import { redirect } from "next/navigation";
32
import Dashboard from "./dashboard";
43
import { headers } from "next/headers";
@@ -27,42 +26,3 @@ export default async function DashboardPage() {
2726
</div>
2827
);
2928
}
30-
{{else}}
31-
import { authClient } from "@/lib/auth-client";
32-
import { redirect } from "next/navigation";
33-
import Dashboard from "./dashboard";
34-
import { headers } from "next/headers";
35-
36-
export default async function DashboardPage() {
37-
const session = await authClient.getSession({
38-
fetchOptions: {
39-
headers: await headers()
40-
}
41-
});
42-
43-
if (!session.data) {
44-
redirect("/login");
45-
}
46-
47-
{{#if (eq payments "polar")}}
48-
const { data: customerState, error } = await authClient.customer.state({
49-
fetchOptions: {
50-
headers: await headers()
51-
}
52-
});
53-
{{/if}}
54-
55-
return (
56-
<div>
57-
<h1>Dashboard</h1>
58-
<p>Welcome {session.data.user.name}</p>
59-
<Dashboard
60-
session={session.data}
61-
{{#if (eq payments "polar")}}
62-
customerState={customerState}
63-
{{/if}}
64-
/>
65-
</div>
66-
);
67-
}
68-
{{/if}}

0 commit comments

Comments
 (0)