From e4afaa5743e01a96d2b72cfd37917c162d19dedb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Gustavo?= <166467972+JoaoGustavo-dev@users.noreply.github.com> Date: Sun, 28 Sep 2025 04:17:18 -0300 Subject: [PATCH] removing-test-pages --- susconecta/app/test-supabase/page.tsx | 83 -------------------------- susconecta/lib/simple-auth.ts | 84 --------------------------- 2 files changed, 167 deletions(-) delete mode 100644 susconecta/app/test-supabase/page.tsx delete mode 100644 susconecta/lib/simple-auth.ts diff --git a/susconecta/app/test-supabase/page.tsx b/susconecta/app/test-supabase/page.tsx deleted file mode 100644 index 07d773e..0000000 --- a/susconecta/app/test-supabase/page.tsx +++ /dev/null @@ -1,83 +0,0 @@ -'use client' - -import { useState } from 'react'; -import { testSupabaseConnection, simpleLogin } from '@/lib/simple-auth'; - -export default function TestPage() { - const [email, setEmail] = useState('test@example.com'); - const [password, setPassword] = useState('123456'); - const [result, setResult] = useState(''); - - const handleTestConnection = async () => { - setResult('Testando conexão...'); - const success = await testSupabaseConnection(); - setResult(success ? '✅ Conexão OK' : '❌ Conexão falhou'); - }; - - const handleSimpleLogin = async () => { - setResult('Tentando login...'); - try { - const response = await simpleLogin(email, password); - setResult(`✅ Login OK: ${JSON.stringify(response, null, 2)}`); - } catch (error) { - setResult(`❌ Login falhou: ${error}`); - } - }; - - return ( -
-
-

🔧 Teste de Conexão Supabase

- -
- - -
-

2. Testar Login:

-
- setEmail(e.target.value)} - className="w-full border rounded px-3 py-2" - /> - setPassword(e.target.value)} - className="w-full border rounded px-3 py-2" - /> - -
-
- -
-

Resultado:

-
{result}
-
- -
-

Como usar:

-
    -
  1. Primeiro teste a conexão básica
  2. -
  3. Se OK, teste o login (qualquer email/senha por enquanto)
  4. -
  5. Veja os logs no console (F12) para mais detalhes
  6. -
-
-
-
-
- ); -} \ No newline at end of file diff --git a/susconecta/lib/simple-auth.ts b/susconecta/lib/simple-auth.ts deleted file mode 100644 index 3ee38ea..0000000 --- a/susconecta/lib/simple-auth.ts +++ /dev/null @@ -1,84 +0,0 @@ -/** - * Versão simplificada para testar conexão com Supabase - */ - -export async function testSupabaseConnection() { - const url = 'https://yuanqfswhberkoevtmfr.supabase.co/rest/v1/'; - const headers = { - 'apikey': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Inl1YW5xZnN3aGJlcmtvZXZ0bWZyIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTQ5NTQzNjksImV4cCI6MjA3MDUzMDM2OX0.g8Fm4XAvtX46zifBZnYVH4tVuQkqUH6Ia9CXQj4DztQ', - 'Content-Type': 'application/json' - }; - - console.log('[TEST] Testando conexão com Supabase...'); - - try { - const response = await fetch(url, { - method: 'GET', - headers - }); - - console.log('[TEST] Status:', response.status); - console.log('[TEST] Headers:', Object.fromEntries(response.headers.entries())); - - if (response.ok) { - console.log('[TEST] ✅ Conexão com Supabase OK!'); - } else { - console.log('[TEST] ❌ Problema na conexão:', response.statusText); - } - - return response.ok; - } catch (error) { - console.error('[TEST] Erro na conexão:', error); - return false; - } -} - -/** - * Versão simplificada do login para debug - */ -export async function simpleLogin(email: string, password: string) { - const url = 'https://yuanqfswhberkoevtmfr.supabase.co/auth/v1/token?grant_type=password'; - - const payload = { - email: email, - password: password - }; - - const headers = { - 'Content-Type': 'application/json', - 'apikey': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Inl1YW5xZnN3aGJlcmtvZXZ0bWZyIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTQ5NTQzNjksImV4cCI6MjA3MDUzMDM2OX0.g8Fm4XAvtX46zifBZnYVH4tVuQkqUH6Ia9CXQj4DztQ', - }; - - console.log('[SIMPLE-LOGIN] Tentando login simples...', { - url, - email, - headers: Object.keys(headers) - }); - - try { - const response = await fetch(url, { - method: 'POST', - headers, - body: JSON.stringify(payload) - }); - - const responseText = await response.text(); - - console.log('[SIMPLE-LOGIN] Response:', { - status: response.status, - statusText: response.statusText, - body: responseText, - headers: Object.fromEntries(response.headers.entries()) - }); - - if (response.ok) { - return JSON.parse(responseText); - } else { - throw new Error(`Login failed: ${response.status} - ${responseText}`); - } - - } catch (error) { - console.error('[SIMPLE-LOGIN] Erro:', error); - throw error; - } -} \ No newline at end of file