Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/components/profile/contract/Contract.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ export default function Contract({ categoriesData, profileData }: ContractProps)
.eq("profile_id", profileId)
.order("updated_at", { ascending: false })
.limit(1)
.single();
.maybeSingle();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MaybeSingle is such a funny name


if (error) {
console.error(error);
} else {
setContract(data.data as ContractData);
setLastUpdated(new Date(data.updated_at));
setContract(data?.data as ContractData);
setLastUpdated(new Date(data?.updated_at));
}
})();
}, [profileId]);
Expand Down Expand Up @@ -150,16 +150,16 @@ function ContractModal({
onSave,
featureMap,
problemCountByCategory,
profileData
profileData,
}: ContractModalProps) {
const [isUpdating, setIsUpdating] = useState(false);
const [isReadOnly, setIsReadOnly] = useState(false);

useEffect(() => {
const checkIfReadOnly = async () => {
try {
if(profileData && profileData.contract_override === true){
setIsReadOnly(false)
if (profileData && profileData.contract_override === true) {
setIsReadOnly(false);
} else {
setIsReadOnly(await fetchContractPerms());
}
Expand Down
Loading