Skip to content

Commit

Permalink
refactor(plugin): order hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
chohner committed Dec 16, 2024
1 parent 5a0859c commit 5e2d69c
Showing 1 changed file with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ type listWorkflowsResponse = {

const HomePage = () => {
const { formatMessage } = useIntl();
const { get, post } = getFetchClient();

const [busy, setBusy] = useState(true);
const [workflows, setWorkflows] = useState<Workflow[]>([]);

const { get, post } = getFetchClient();
const [modelOpen, setModelOpen] = useState(false);
const [alertContent, setAlertContent] = useState('');
const [alertVariant, setAlertVariant] = useState<AlertVariant>('closed');

const refresh = async () => {
setBusy(true);
Expand All @@ -36,14 +38,6 @@ const HomePage = () => {
});
};

useEffect(() => {
refresh();
}, []);

const [modelOpen, setModelOpen] = useState(false);
const [alertContent, setAlertContent] = useState('');
const [alertVariant, setAlertVariant] = useState<AlertVariant>('closed');

const trigger = () => {
setBusy(true);
post<{ success: boolean; error: unknown }>(`/${PLUGIN_ID}/trigger`).then(({ data }) => {
Expand All @@ -59,6 +53,10 @@ const HomePage = () => {
});
};

useEffect(() => {
refresh();
}, []);

// See https://design-system-git-main-strapijs.vercel.app/
return (
<Main>
Expand Down

0 comments on commit 5e2d69c

Please sign in to comment.