feat: auth & admin
This commit is contained in:
@@ -13,17 +13,17 @@ If a side effect is triggered by a specific user action (submit, click, drag), r
|
||||
|
||||
```tsx
|
||||
function Form() {
|
||||
const [submitted, setSubmitted] = useState(false)
|
||||
const theme = useContext(ThemeContext)
|
||||
const [submitted, setSubmitted] = useState(false);
|
||||
const theme = useContext(ThemeContext);
|
||||
|
||||
useEffect(() => {
|
||||
if (submitted) {
|
||||
post('/api/register')
|
||||
showToast('Registered', theme)
|
||||
post('/api/register');
|
||||
showToast('Registered', theme);
|
||||
}
|
||||
}, [submitted, theme])
|
||||
}, [submitted, theme]);
|
||||
|
||||
return <button onClick={() => setSubmitted(true)}>Submit</button>
|
||||
return <button onClick={() => setSubmitted(true)}>Submit</button>;
|
||||
}
|
||||
```
|
||||
|
||||
@@ -31,14 +31,14 @@ function Form() {
|
||||
|
||||
```tsx
|
||||
function Form() {
|
||||
const theme = useContext(ThemeContext)
|
||||
const theme = useContext(ThemeContext);
|
||||
|
||||
function handleSubmit() {
|
||||
post('/api/register')
|
||||
showToast('Registered', theme)
|
||||
post('/api/register');
|
||||
showToast('Registered', theme);
|
||||
}
|
||||
|
||||
return <button onClick={handleSubmit}>Submit</button>
|
||||
return <button onClick={handleSubmit}>Submit</button>;
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user