Skip to content

Commit

Permalink
fix(console): reset form as soon as JWT customizer is created
Browse files Browse the repository at this point in the history
  • Loading branch information
darcyYe committed Apr 1, 2024
1 parent 977776d commit 8be5f68
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,18 @@ function MainContent<T extends LogtoJwtTokenPath>({

await api.put(getApiPath(tokenType), { json: payload });

if (action === 'create') {
navigate(-1);
return;
}

const result = await mutate();

reset(formatResponseDataToFormData(tokenType, result));

/**
* Should `reset` (to set `isDirty` to false) before navigating back to the custom JWT listing page.
* Otherwise, the unsaved changes alert modal will be triggered on clicking `create` button, which
* is not expected.
*/
if (action === 'create') {
navigate(-1);
}
})
);

Expand Down

0 comments on commit 8be5f68

Please sign in to comment.