Refactored Supabase Clients using the new recommended approach by Supabase by centralizing all clients around one single implementation. (#51)
The previous clients have been marked as deprecated and will be removed at some point.
This commit is contained in:
committed by
GitHub
parent
2f0c4b4ae3
commit
ba6e649461
@@ -7,7 +7,7 @@ import {
|
||||
} from 'lucide-react';
|
||||
|
||||
import { Database } from '@kit/supabase/database';
|
||||
import { getSupabaseServerComponentClient } from '@kit/supabase/server-component-client';
|
||||
import { getSupabaseServerAdminClient } from '@kit/supabase/server-admin-client';
|
||||
import { Alert, AlertDescription, AlertTitle } from '@kit/ui/alert';
|
||||
import { AppBreadcrumbs } from '@kit/ui/app-breadcrumbs';
|
||||
import { Badge } from '@kit/ui/badge';
|
||||
@@ -49,9 +49,7 @@ export function AdminAccountPage(props: {
|
||||
}
|
||||
|
||||
async function PersonalAccountPage(props: { account: Account }) {
|
||||
const client = getSupabaseServerComponentClient({
|
||||
admin: true,
|
||||
});
|
||||
const client = getSupabaseServerAdminClient();
|
||||
|
||||
const memberships = await getMemberships(props.account.id);
|
||||
const { data, error } = await client.auth.admin.getUserById(props.account.id);
|
||||
@@ -196,9 +194,7 @@ async function TeamAccountPage(props: {
|
||||
}
|
||||
|
||||
async function SubscriptionsTable(props: { accountId: string }) {
|
||||
const client = getSupabaseServerComponentClient({
|
||||
admin: true,
|
||||
});
|
||||
const client = getSupabaseServerAdminClient();
|
||||
|
||||
const { data: subscription, error } = await client
|
||||
.from('subscriptions')
|
||||
@@ -345,9 +341,7 @@ async function SubscriptionsTable(props: { accountId: string }) {
|
||||
}
|
||||
|
||||
async function getMemberships(userId: string) {
|
||||
const client = getSupabaseServerComponentClient({
|
||||
admin: true,
|
||||
});
|
||||
const client = getSupabaseServerAdminClient();
|
||||
|
||||
const memberships = await client
|
||||
.from('accounts_memberships')
|
||||
@@ -370,9 +364,7 @@ async function getMemberships(userId: string) {
|
||||
}
|
||||
|
||||
async function getMembers(accountSlug: string) {
|
||||
const client = getSupabaseServerComponentClient({
|
||||
admin: true,
|
||||
});
|
||||
const client = getSupabaseServerAdminClient();
|
||||
|
||||
const members = await client.rpc('get_account_members', {
|
||||
account_slug: accountSlug,
|
||||
|
||||
Reference in New Issue
Block a user