-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'jeremy-clerk/jeremy-clerk/troubleshooting'
- Loading branch information
Showing
11 changed files
with
118 additions
and
70 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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Recommended to have an example env file for other users know what environment variables need to be set. | ||
|
||
# Get your keys from the Clerk dashboard at https://dashboard.clerk.com | ||
CLERK_SECRET_KEY=sk_ | ||
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_ | ||
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in | ||
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up | ||
|
||
# If using a local docker container (local-database.yml) | ||
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/lockscript?schema=public |
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 |
---|---|---|
|
@@ -35,3 +35,6 @@ yarn-error.log* | |
# typescript | ||
*.tsbuildinfo | ||
next-env.d.ts | ||
|
||
#Intellij Editors | ||
.idea |
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,17 @@ | ||
# Use postgres/example user/password credentials | ||
version: '3.1' | ||
services: | ||
db: | ||
container_name: lockscript-postgres | ||
image: postgres | ||
restart: always | ||
ports: | ||
- "5432:5432" | ||
environment: | ||
POSTGRES_PASSWORD: postgres | ||
volumes: | ||
- postgres:/var/lib/postgres/data | ||
volumes: | ||
postgres: | ||
external: false | ||
|
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 |
---|---|---|
@@ -1,32 +1,19 @@ | ||
import {VaultPage} from "@/components/vault/vault-page"; | ||
import prismadb from "@/lib/prismadb"; | ||
import {auth} from "@clerk/nextjs/server"; | ||
import {instantiateVault} from "../actions"; | ||
import {auth, currentUser} from "@clerk/nextjs/server"; | ||
import {getPasswords, instantiateVault} from "../actions"; | ||
|
||
export const dynamic = "force-dynamic"; | ||
|
||
const Page = async () => { | ||
export default async function Page(){ | ||
const { userId, redirectToSignIn } = await auth(); | ||
|
||
if (!userId) return redirectToSignIn(); | ||
|
||
const user = await prismadb.user.findUnique({ | ||
where: { | ||
id: userId, | ||
}, | ||
include: { | ||
passwordItems: true, | ||
cardItems: true, | ||
pinItems: true, | ||
noteItems: true, | ||
}, | ||
}); | ||
const user = await getPasswords(userId) | ||
|
||
if (!user) { | ||
instantiateVault(); | ||
const clerkUser = await currentUser() | ||
if(!clerkUser) return redirectToSignIn() | ||
await instantiateVault(clerkUser.id, clerkUser.username as string); | ||
} | ||
|
||
return <VaultPage user={user} />; | ||
}; | ||
|
||
export default Page; |
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