feat: onboarding for existing users (#160)

* feat: onboarding for existing users

* fix: escape character

* chore: update msg
This commit is contained in:
Aslam
2024-09-10 22:05:28 +07:00
committed by GitHub
parent 00a2a53781
commit 0668dd5625
5 changed files with 219 additions and 0 deletions

View File

@@ -1,6 +1,8 @@
"use server"
import { authedProcedure } from "@/lib/utils/auth-procedure"
import { currentUser } from "@clerk/nextjs/server"
import { get } from "ronin"
import { create } from "ronin"
import { z } from "zod"
import { ZSAError } from "zsa"
@@ -68,3 +70,9 @@ export const storeImage = authedProcedure
throw new ZSAError("ERROR", "Failed to store image")
}
})
export const isExistingUser = async () => {
const clerkUser = await currentUser()
const roninUser = await get.existingStripeSubscriber.with({ email: clerkUser?.emailAddresses[0].emailAddress })
return clerkUser?.emailAddresses[0].emailAddress === roninUser?.email
}