chore: remove api base url log from client

This commit is contained in:
Bereket Engida
2024-10-12 01:40:05 +03:00
parent b3fdd5a808
commit 4b36770eec
4 changed files with 14 additions and 16 deletions

View File

@@ -38,3 +38,5 @@ yarn-error.log*
# typescript
*.tsbuildinfo
next-env.d.ts
certificates

View File

@@ -4,6 +4,7 @@
"private": true,
"scripts": {
"dev": "next dev",
"dev:secure": "next dev --experimental-https",
"build": "next build",
"start": "next start",
"lint": "next lint"

View File

@@ -34,11 +34,6 @@ export const csrfPlugin = {
id: "csrf",
name: "CSRF Check",
async init(url, options) {
if (!options?.baseURL) {
throw new BetterAuthError(
"API Base URL on the auth client isn't configured. Please pass it directly to the client `baseURL`",
);
}
if (options?.method !== "GET") {
options = options || {};
const { data, error } = await betterFetch<{

View File

@@ -14,7 +14,7 @@ export function getCookies(options: BetterAuthOptions) {
const cookiePrefix = "better-auth";
const sessionMaxAge = new TimeSpan(7, "d").seconds();
const crossSubdomainEnabled =
options.advanced?.crossSubDomainCookies?.enabled;
!!options.advanced?.crossSubDomainCookies?.enabled;
const domain = crossSubdomainEnabled
? options.advanced?.crossSubDomainCookies?.domain ||
@@ -37,7 +37,7 @@ export function getCookies(options: BetterAuthOptions) {
path: "/",
secure: !!secureCookiePrefix,
maxAge: sessionMaxAge,
...(crossSubdomainEnabled && { domain }),
...(crossSubdomainEnabled ? { domain } : {}),
} satisfies CookieOptions,
},
csrfToken: {
@@ -48,7 +48,7 @@ export function getCookies(options: BetterAuthOptions) {
path: "/",
secure: !!secureCookiePrefix,
maxAge: 60 * 60 * 24 * 7,
...(crossSubdomainEnabled && { domain }),
...(crossSubdomainEnabled ? { domain } : {}),
} satisfies CookieOptions,
},
state: {
@@ -58,8 +58,8 @@ export function getCookies(options: BetterAuthOptions) {
sameSite,
path: "/",
secure: !!secureCookiePrefix,
maxAge: 60 * 15, // 15 minutes in seconds
...(crossSubdomainEnabled && { domain }),
maxAge: 60 * 15,
...(crossSubdomainEnabled ? { domain } : {}),
} satisfies CookieOptions,
},
pkCodeVerifier: {
@@ -69,8 +69,8 @@ export function getCookies(options: BetterAuthOptions) {
sameSite,
path: "/",
secure: !!secureCookiePrefix,
maxAge: 60 * 15, // 15 minutes in seconds
...(crossSubdomainEnabled && { domain }),
maxAge: 60 * 15,
...(crossSubdomainEnabled ? { domain } : {}),
} as CookieOptions,
},
dontRememberToken: {
@@ -81,7 +81,7 @@ export function getCookies(options: BetterAuthOptions) {
path: "/",
secure: !!secureCookiePrefix,
//no max age so it expires when the browser closes
...(crossSubdomainEnabled && { domain }),
...(crossSubdomainEnabled ? { domain } : {}),
} as CookieOptions,
},
nonce: {
@@ -91,8 +91,8 @@ export function getCookies(options: BetterAuthOptions) {
sameSite,
path: "/",
secure: !!secureCookiePrefix,
maxAge: 60 * 15, // 15 minutes in seconds
...(crossSubdomainEnabled && { domain }),
maxAge: 60 * 15,
...(crossSubdomainEnabled ? { domain } : {}),
} as CookieOptions,
},
};
@@ -127,7 +127,7 @@ export function createCookieGetter(options: BetterAuthOptions) {
path: "/",
maxAge: 60 * 15, // 15 minutes in seconds
...opts,
...(crossSubdomainEnabled && { domain }),
...(crossSubdomainEnabled ? { domain } : {}),
} as CookieOptions,
};
}