feat: add database transaction support(#2983)

This commit is contained in:
Dan Ribbens
2023-07-21 14:13:18 -04:00
committed by GitHub
parent c8c22dad06
commit 8a681450d1
495 changed files with 22228 additions and 8512 deletions

29
test/auth/AuthDebug.tsx Normal file
View File

@@ -0,0 +1,29 @@
import React, { useEffect, useState } from 'react';
import { useAuth } from '../../src/admin/components/utilities/Auth';
import { User } from '../../src/auth';
import { UIField } from '../../src/fields/config/types';
export const AuthDebug: React.FC<UIField> = () => {
const [state, setState] = useState<User | null | undefined>();
const { user } = useAuth();
useEffect(() => {
const fetchUser = async () => {
const userRes = await fetch(`/api/users/${user?.id}`)?.then((res) => res.json());
setState(userRes);
};
fetchUser();
}, [user]);
return (
<div id="auth-debug">
<div id="use-auth-result">
{user?.custom as string}
</div>
<div id="users-api-result">
{state?.custom as string}
</div>
</div>
);
};