Files
euchre_camp/src/app/test-api/page.tsx
T
david 123df671f5 nextjs-rewrite (#5)
Reviewed-on: #5
Co-authored-by: David Gwilliam <dhgwilliam@gmail.com>
Co-committed-by: David Gwilliam <dhgwilliam@gmail.com>
2026-03-30 02:30:13 +00:00

33 lines
844 B
TypeScript

'use client';
import { authClient } from '@/lib/auth-client';
import { useEffect, useState } from 'react';
export default function TestApi() {
const [result, setResult] = useState<any>(null);
const [error, setError] = useState<string | null>(null);
useEffect(() => {
async function test() {
try {
const response = await authClient.signIn.email({
email: 'david@dhg.lol',
password: 'admin1234'
});
setResult(response);
} catch (err: any) {
setError(err.message);
}
}
test();
}, []);
return (
<div style={{ padding: '2rem' }}>
<h1>Test Auth API</h1>
{error && <p style={{ color: 'red' }}>Error: {error}</p>}
{result && <pre>{JSON.stringify(result, null, 2)}</pre>}
{!result && !error && <p>Loading...</p>}
</div>
);
}