Skip to content

Commit

Permalink
Lint supabase
Browse files Browse the repository at this point in the history
  • Loading branch information
Luisotee committed Jan 23, 2025
1 parent 57343e5 commit 313f459
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
5 changes: 3 additions & 2 deletions packages/supabase/src/clients/client.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { config } from "@eda/config";
import { createBrowserClient } from "@supabase/ssr";
import type { Database } from "../types";

export const createClient = () =>
createBrowserClient<Database>(
process.env.NEXT_PUBLIC_SUPABASE_URL!,
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
config.databases.supabase.url,
config.api_keys.supabase.anon_key,
);
6 changes: 3 additions & 3 deletions packages/supabase/src/clients/middleware.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { config } from "@eda/config";
import { createServerClient } from "@supabase/ssr";
import type { NextRequest, NextResponse } from "next/server";

Expand All @@ -6,8 +7,8 @@ export const updateSession = async (
response: NextResponse,
) => {
const supabase = createServerClient(
process.env.NEXT_PUBLIC_SUPABASE_URL!,
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
config.databases.supabase.url,
config.api_keys.supabase.anon_key,
{
cookies: {
getAll() {
Expand All @@ -26,7 +27,6 @@ export const updateSession = async (
},
);

// This is to ensure the session is updated
const {
data: { user },
} = await supabase.auth.getUser();
Expand Down
5 changes: 3 additions & 2 deletions packages/supabase/src/clients/server.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { config } from "@eda/config";
import { createServerClient } from "@supabase/ssr";
import { cookies } from "next/headers";
import type { Database } from "../types";
Expand All @@ -6,8 +7,8 @@ export const createClient = () => {
const cookieStore = cookies();

return createServerClient<Database>(
process.env.NEXT_PUBLIC_SUPABASE_URL!,
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
config.databases.supabase.url,
config.api_keys.supabase.service_key,
{
cookies: {
getAll() {
Expand Down

0 comments on commit 313f459

Please sign in to comment.