-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(read-only): add read only mode to webforms (#329)
* feat: disabled and readonly set for rhf comps * chore: fix footer to be footer * feat: add user role check for readonly - readonly based off user role - change the webform component to load data before setting default values through useForm - this change should fix the controlled component error message * fix: remove submit button when read only * Update index.tsx * fix: remove unnecessary context and use fieldset - remove readonly context from majority of components - use fieldset to set disabled for majority of components - change readonly role to just state submitter for now * chore: addtnl cleanup * chore: addtnl cleanup 2
- Loading branch information
1 parent
d80d5b2
commit 6f25758
Showing
3 changed files
with
63 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { useGetUser } from "@/api/useGetUser"; | ||
import { UserRoles } from "shared-types"; | ||
|
||
export const useReadOnlyUser = () => { | ||
const { data } = useGetUser(); | ||
const role = data?.user?.["custom:cms-roles"]; | ||
return role !== UserRoles.STATE_SUBMITTER; | ||
}; |