Skip to content

Commit

Permalink
chore: fix absolute routes (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanleecode authored Apr 10, 2024
1 parent 4914d9e commit c484e20
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/lib/auth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { DrizzlePostgreSQLAdapter } from "@lucia-auth/adapter-drizzle";
import { env } from "@/env.js";
import { db } from "@/server/db";
import { sessions, users, type User as DbUser } from "@/server/db/schema";
import { absoluteUrl } from "@/lib/utils"

// Uncomment the following lines if you are using nodejs 18 or lower. Not required in Node.js 20, CloudFlare Workers, Deno, Bun, and Vercel Edge Functions.
// import { webcrypto } from "node:crypto";
Expand Down Expand Up @@ -39,7 +40,7 @@ export const lucia = new Lucia(adapter, {
export const discord = new Discord(
env.DISCORD_CLIENT_ID,
env.DISCORD_CLIENT_SECRET,
env.NEXT_PUBLIC_APP_URL + "/login/discord/callback",
absoluteUrl("/login/discord/callback")
);

declare module "lucia" {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ export function formatPrice(
}

export function absoluteUrl(path: string) {
return `${env.NEXT_PUBLIC_APP_URL}${path}`;
return new URL(path, env.NEXT_PUBLIC_APP_URL).href
}

0 comments on commit c484e20

Please sign in to comment.