1
0
Fork 0
mirror of https://gitbruv.vercel.app/api/git/bruv/gitbruv.git synced 2025-12-20 23:24:09 +01:00
This commit is contained in:
Ahmet Kilinc 2025-12-20 03:31:39 +00:00
parent 2483a758c8
commit 698cf2bcd9
4 changed files with 27 additions and 48 deletions

View file

@ -1,16 +1,12 @@
import { createAuthClient } from "better-auth/react";
import { getPublicServerUrl } from "./utils";
export const authClient = createAuthClient({
baseURL: process.env.NEXT_PUBLIC_APP_URL || "http://localhost:3000",
baseURL: getPublicServerUrl(),
});
export const { signIn, signOut, useSession } = authClient;
export async function signUpWithUsername(data: {
email: string;
password: string;
name: string;
username: string;
}) {
export async function signUpWithUsername(data: { email: string; password: string; name: string; username: string }) {
return authClient.signUp.email(data as Parameters<typeof authClient.signUp.email>[0]);
}

View file

@ -1,6 +1,16 @@
import { clsx, type ClassValue } from "clsx"
import { twMerge } from "tailwind-merge"
import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
return twMerge(clsx(inputs));
}
export const getPublicServerUrl = () => {
if (process.env.NEXT_PUBLIC_VERCEL_ENV === "production") {
return `https://${process.env.NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL}`;
} else if (process.env.NEXT_PUBLIC_VERCEL_ENV === "preview") {
return `https://${process.env.NEXT_PUBLIC_VERCEL_BRANCH_URL}`;
} else {
return `http://localhost:3000`;
}
};