nextjs-rewrite (#5)
Reviewed-on: #5 Co-authored-by: David Gwilliam <dhgwilliam@gmail.com> Co-committed-by: David Gwilliam <dhgwilliam@gmail.com>
This commit was merged in pull request #5.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
'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>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user