diff --git a/.env b/.env
index de01764..c36a915 100644
--- a/.env
+++ b/.env
@@ -1,2 +1,3 @@
NEXT_PUBLIC_SUPABASE_URL=http://127.0.0.1:54321
-NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0
\ No newline at end of file
+NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0
+NEXT_PUBLIC_SUPABASE_SERVICE_ROLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImV4cCI6MTk4MzgxMjk5Nn0.EGIM96RAZx35lJzdJsyH-qQwv8Hdp7fsn3W0YpN81IU
\ No newline at end of file
diff --git a/app/admin/page.tsx b/app/admin/page.tsx
deleted file mode 100644
index 22a0424..0000000
--- a/app/admin/page.tsx
+++ /dev/null
@@ -1,72 +0,0 @@
-"use client";
-import { createClient } from "@/utils/supabase/client";
-import React, { useState, useEffect } from 'react';
-
-function PageComponent() {
- const supabase = createClient();
-
- const getData = async () => {
- }
- const fakeData = [
- { email: 'example1@example.com', ip: '192.168.0.1' },
- { email: 'example2@example.com', ip: '192.168.0.2' },
- { email: 'example3@example.com', ip: '192.168.0.3' },
- { email: 'example1@example.com', ip: '192.168.0.1' },
- { email: 'example2@example.com', ip: '192.168.0.2' },
- { email: 'example3@example.com', ip: '192.168.0.3' },
- { email: 'example1@example.com', ip: '192.168.0.1' },
- { email: 'example2@example.com', ip: '192.168.0.2' },
- { email: 'example3@example.com', ip: '192.168.0.3' },
- { email: 'example1@example.com', ip: '192.168.0.1' },
- { email: 'example2@example.com', ip: '192.168.0.2' },
- { email: 'example3@example.com', ip: '192.168.0.3' },
- { email: 'example1@example.com', ip: '192.168.0.1' },
- { email: 'example2@example.com', ip: '192.168.0.2' },
- { email: 'example3@example.com', ip: '192.168.0.3' },
- { email: 'example1@example.com', ip: '192.168.0.1' },
- { email: 'example2@example.com', ip: '192.168.0.2' },
- { email: 'example3@example.com', ip: '192.168.0.3' },
- { email: 'example1@example.com', ip: '192.168.0.1' },
- { email: 'example2@example.com', ip: '192.168.0.2' },
- { email: 'example3@example.com', ip: '192.168.0.3' },
- ];
-
- useEffect(() => {
- getData();
- }, []);
- return (
-
-
-
-
-
-
-
-
-
- |
- |
- |
-
-
-
- {fakeData.map((data, index) => (
-
- {data.email} |
- {data.ip} |
- |
-
- ))}
-
-
-
-
-
-
- );
-}
-
-export default PageComponent;
-
-
-
diff --git a/app/admin/tiers/create/page.tsx b/app/admin/tiers/create/page.tsx
new file mode 100644
index 0000000..02a98db
--- /dev/null
+++ b/app/admin/tiers/create/page.tsx
@@ -0,0 +1,57 @@
+"use client";
+import { createClient } from "@/utils/supabase/client";
+import React, { useState, useEffect } from 'react';
+
+function PageComponent() {
+ const supabase = createClient();
+ const getData = async () => {
+ }
+
+ useEffect(() => {
+ getData();
+ }, []);
+return (
+
+);
+}
+
+export default PageComponent;
+
+
+
diff --git a/app/admin/tiers/page.tsx b/app/admin/tiers/page.tsx
new file mode 100644
index 0000000..5e6fb41
--- /dev/null
+++ b/app/admin/tiers/page.tsx
@@ -0,0 +1,61 @@
+"use client";
+import { createClient } from "@/utils/supabase/client";
+import React, { useState, useEffect } from 'react';
+
+function PageComponent() {
+ const supabase = createClient();
+ const getData = async () => {
+ }
+
+ useEffect(() => {
+ getData();
+ }, []);
+
+
+const fakeData = [
+ {
+ description: "Lorem ipsum dolor sit amet",
+ color: "#5e3573",
+ price: 9.99,
+ name: "Product 1"
+ },
+ {
+ description: "Consectetur adipiscing elit",
+ color: "#00FF00",
+ price: 19.99,
+ name: "Product 2"
+ },
+ {
+ description: "Sed do eiusmod tempor incididunt",
+ color: "#0000FF",
+ price: 29.99,
+ name: "Product 3"
+ }
+];
+
+// Rest of the code...
+
+return (
+
+
+
+
+
+
+ {fakeData.map((item, index) => (
+
+ ))}
+
+
+
+);
+}
+
+export default PageComponent;
+
+
+
diff --git a/app/admin/tiers/view/page.tsx b/app/admin/tiers/view/page.tsx
new file mode 100644
index 0000000..e6a705b
--- /dev/null
+++ b/app/admin/tiers/view/page.tsx
@@ -0,0 +1,61 @@
+"use client";
+import { createClient } from "@/utils/supabase/client";
+import React, { useState, useEffect } from 'react';
+
+function PageComponent() {
+ const supabase = createClient();
+ const getData = async () => {
+ }
+
+ useEffect(() => {
+ getData();
+ }, []);
+return (
+
+);
+}
+
+export default PageComponent;
+
+
+
diff --git a/app/admin/users/page.tsx b/app/admin/users/page.tsx
new file mode 100644
index 0000000..87c2311
--- /dev/null
+++ b/app/admin/users/page.tsx
@@ -0,0 +1,59 @@
+"use client";
+import { createClient } from "@/utils/supabase/client";
+import React, { useState, useEffect } from 'react';
+
+function PageComponent() {
+ const supabase = createClient();
+ const [users, setUsers] = useState([]);
+ 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 (
+
+
+
+
+
+
+
+
+
+ |
+ |
+
+
+
+ {users.map((data, index) => (
+
+ {data.email} |
+ |
+
+ ))}
+
+
+
+
+
+
+ );
+}
+
+export default PageComponent;
+
+
+
diff --git a/app/api/admin/users/route.tsx b/app/api/admin/users/route.tsx
new file mode 100644
index 0000000..7f550f9
--- /dev/null
+++ b/app/api/admin/users/route.tsx
@@ -0,0 +1,19 @@
+import { NextApiRequest, NextApiResponse } from 'next';
+import { createClient } from "@/utils/supabase/server";
+import { NextResponse } from "next/server";
+
+export async function GET(request: Request) {
+ try {
+ const supabase = createClient();
+
+ const { data, error } = await supabase.auth.admin.listUsers();
+ console.log(error)
+ if (error) {
+ throw error;
+ }
+
+ return NextResponse.json(data);
+ } catch (error) {
+ return NextResponse.error();
+ }
+}
\ No newline at end of file
diff --git a/app/api/tiers/route.ts b/app/api/tiers/route.ts
index 4a45f77..4926400 100644
--- a/app/api/tiers/route.ts
+++ b/app/api/tiers/route.ts
@@ -2,18 +2,25 @@ import { NextResponse } from "next/server";
import { createClient } from "@/utils/supabase/server";
-enum customTypeOptions
-{
- Free,
- Tier1,
- Tier2,
- Tier3
-}
-
export async function GET(request: Request) {
const supabase = createClient();
-
- return NextResponse.json(customTypeOptions);
+ const { data, error } = await supabase.from('tiers').select('*');
+ if (error) {
+ console.error('Error fetching tiers:', error);
+ return NextResponse.error();
+ }
+ const tiers = data ?? [];
+ return NextResponse.json(tiers);
}
+export async function POST(request: Request) {
+ const supabase = createClient();
+ const { name, price, color, description } = await request.json();
+ const { data, error } = await supabase.from('tiers').insert([{ name, price, color, description }]);
+ if (error) {
+ console.error('Error inserting tier:', error);
+ return NextResponse.error();
+ }
+ return NextResponse.json(data);
+}
\ No newline at end of file
diff --git a/app/gallery/admin/page.tsx b/app/gallery/admin/page.tsx
index 34c3e9d..74c0acb 100644
--- a/app/gallery/admin/page.tsx
+++ b/app/gallery/admin/page.tsx
@@ -69,75 +69,35 @@ function PageComponent() {
];
return (
-
-
-
-
{setNewTagName(e.target.value)}} className="hover:scale-105 focus:scale-105 mb-8 mr-2 rounded-md bg-info-bright p-2 w-1/2 text-black shadow-lg" placeholder="Tag Name" />
-