Improve MineGeo exploration and mapping features

This commit is contained in:
2026-10-05 13:41:36 +05:00
parent aec0641f87
commit c5368fa8cc
69 changed files with 3581 additions and 333 deletions

View File

@@ -2,6 +2,7 @@ import "server-only";
import { createClient } from "@supabase/supabase-js";
import { createServerClient } from "@supabase/ssr";
import { cookies } from "next/headers";
import { cache } from "react";
import type { Database } from "@/shared/database";
let singleton: ReturnType<typeof createClient<Database>> | undefined;
export function admin() {
@@ -36,13 +37,18 @@ export async function authClient() {
},
);
}
export async function user() {
export const user = cache(async function user() {
if (
!process.env.NEXT_PUBLIC_SUPABASE_URL ||
!process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY
)
return null;
const client = await authClient();
const {
data: { user },
} = await client.auth.getUser();
return user;
}
});
export function required<T>(result: {
data: T;
error: { message: string } | null;