Compare commits

..

6 Commits

Author SHA1 Message Date
2e19d5fdeb Update .env 2024-06-08 20:44:20 -04:00
63f31e0f4c Update server.ts 2024-06-08 20:08:25 -04:00
f75d889ee8 Delete page.tsx 2024-06-08 19:51:44 -04:00
8877362484 Update server.ts 2024-06-08 19:50:08 -04:00
082c161959 Update page.tsx 2024-06-08 19:45:31 -04:00
5d96002a2e fix 2024-06-08 19:43:26 -04:00
8 changed files with 7 additions and 67 deletions

3
.env
View File

@ -1,3 +1,2 @@
NEXT_PUBLIC_SUPABASE_URL=http://127.0.0.1:54321 NEXT_PUBLIC_SUPABASE_URL=http://127.0.0.1:54321
NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0 NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0
NEXT_PUBLIC_SUPABASE_SERVICE_ROLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImV4cCI6MTk4MzgxMjk5Nn0.EGIM96RAZx35lJzdJsyH-qQwv8Hdp7fsn3W0YpN81IU

View File

@ -14,7 +14,7 @@ function PageComponent() {
const data = await response.json(); const data = await response.json();
setTiers(data); setTiers(data);
} else { } else {
console.error('Failed to fetch users'); console.error('failed to fetch tiers');
} }
} catch (error) { } catch (error) {
console.error('Error fetching users:', error); console.error('Error fetching users:', error);

View File

@ -25,7 +25,7 @@ function PageComponent() {
setDescription(data.description); setDescription(data.description);
setColor(data.color); setColor(data.color);
} else { } else {
console.error('Failed to fetch users'); console.error('failed to fetch tiers');
} }
} catch (error) { } catch (error) {
console.error('Error fetching users:', error); console.error('Error fetching users:', error);

View File

@ -1,59 +0,0 @@
"use client";
import { createClient } from "@/utils/supabase/client";
import React, { useState, useEffect } from 'react';
function PageComponent() {
const supabase = createClient();
const [users, setUsers] = useState<any[]>([]);
const getData = async () => {
try {
const response = await fetch('/api/admin/users');
if (response.ok) {
const data = await response.json();
console.log(data)
setUsers(data.users);
} else {
console.error('Failed to fetch users');
}
} catch (error) {
console.error('Error fetching users:', error);
}
}
useEffect(() => {
getData();
}, []);
return (
<div className="w-full text-white flex justify-center items-center animate-in">
<div className="w-2/3 rounded-md bg-primary p-12 mt-32 shadow-lg opacity-90 backdrop-blur-lg">
<div className="w-2/5 rounded-md bg-secondary-dark p-12 shadow-lg opacity-90 backdrop-blur-lg">
<input type="text" className="mb-4 mr-2 rounded-md bg-primary p-2 w-full text-white" placeholder="Search all users by email" />
<div className="w-full h-96 overflow-y-scroll no-scrollbar">
<table className="w-full">
<thead>
<tr>
<th className="px-4 py-2"></th>
<th className="px-4 py-2"></th>
</tr>
</thead>
<tbody>
{users.map((data, index) => (
<tr key={index} className="rounded hover:bg-primary bg-primary-light shadow-lg">
<td className="px-4 py-2">{data.email}</td>
<td className="px-4 py-2"><button className="p-2 rounded w-full hover:bg-primary-light bg-primary">View</button></td>
</tr>
))}
</tbody>
</table>
</div>
</div>
</div>
</div>
);
}
export default PageComponent;

View File

@ -26,7 +26,7 @@ function PageComponent() {
const data = await response.json(); const data = await response.json();
setTiers(data); setTiers(data);
} else { } else {
console.error('Failed to fetch users'); console.error('failed to fetch tiers');
} }
} catch (error) { } catch (error) {
console.error('Error fetching users:', error); console.error('Error fetching users:', error);

View File

@ -33,7 +33,7 @@ function PageComponent() {
const data = await response.json(); const data = await response.json();
setTiers(data); setTiers(data);
} else { } else {
console.error('Failed to fetch users'); console.error('failed to fetch tiers');
} }
} catch (error) { } catch (error) {
console.error('Error fetching users:', error); console.error('Error fetching users:', error);

View File

@ -32,7 +32,7 @@ const Galleries = ({ nsfw, tags, search, gallerySelected }: TagProps) => {
const data = await response.json(); const data = await response.json();
setTiers(data); setTiers(data);
} else { } else {
console.error('Failed to fetch users'); console.error('failed to fetch tiers');
} }
} catch (error) { } catch (error) {
console.error('Error fetching users:', error); console.error('Error fetching users:', error);

View File

@ -6,7 +6,7 @@ export const createClient = () => {
return createServerClient( return createServerClient(
process.env.NEXT_PUBLIC_SUPABASE_URL!, process.env.NEXT_PUBLIC_SUPABASE_URL!,
process.env.NEXT_PUBLIC_SUPABASE_SERVICE_ROLE_KEY!, process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
{ {
cookies: { cookies: {
get(name: string) { get(name: string) {