1
- import { type UnitDetail , UnitDetailDefaultProductPrivacy } from "@squonk/account-server-client" ;
1
+ import {
2
+ type UnitAllDetail ,
3
+ UnitAllDetailDefaultProductPrivacy ,
4
+ } from "@squonk/account-server-client" ;
2
5
import {
3
6
getGetUnitQueryKey ,
4
7
getGetUnitsQueryKey ,
@@ -14,7 +17,7 @@ import { useSelectedUnit } from "../../state/unitSelection";
14
17
import { capitalise , shoutSnakeToLowerCase } from "../../utils/app/language" ;
15
18
16
19
export interface EditDefaultPrivacyProps {
17
- unit : UnitDetail ;
20
+ unit : UnitAllDetail ;
18
21
}
19
22
20
23
export const EditDefaultPrivacy = ( { unit } : EditDefaultPrivacyProps ) => {
@@ -25,7 +28,7 @@ export const EditDefaultPrivacy = ({ unit }: EditDefaultPrivacyProps) => {
25
28
const { enqueueError, enqueueSnackbar } = useEnqueueError ( ) ;
26
29
const queryClient = useQueryClient ( ) ;
27
30
28
- const handleSelection = async ( newValue : UnitDetailDefaultProductPrivacy ) => {
31
+ const handleSelection = async ( newValue : UnitAllDetailDefaultProductPrivacy ) => {
29
32
try {
30
33
await patchUnit ( {
31
34
unitId : unit . id ,
@@ -37,7 +40,7 @@ export const EditDefaultPrivacy = ({ unit }: EditDefaultPrivacyProps) => {
37
40
await queryClient . invalidateQueries ( { queryKey : getGetUnitQueryKey ( unit . id ) } ) ;
38
41
enqueueSnackbar ( "Unit default privacy updated" , { variant : "success" } ) ;
39
42
40
- const newUnit = { ...unit , default_product_privacy : newValue } satisfies UnitDetail ;
43
+ const newUnit = { ...unit , default_product_privacy : newValue } satisfies UnitAllDetail ;
41
44
setUnit ( newUnit ) ;
42
45
} catch ( error ) {
43
46
enqueueError ( error ) ;
@@ -64,10 +67,10 @@ export const EditDefaultPrivacy = ({ unit }: EditDefaultPrivacyProps) => {
64
67
label = "Default project privacy"
65
68
value = { unit . default_product_privacy }
66
69
onChange = { ( event ) =>
67
- void handleSelection ( event . target . value as UnitDetailDefaultProductPrivacy )
70
+ void handleSelection ( event . target . value as UnitAllDetailDefaultProductPrivacy )
68
71
}
69
72
>
70
- { Object . values ( UnitDetailDefaultProductPrivacy ) . map ( ( rule ) => (
73
+ { Object . values ( UnitAllDetailDefaultProductPrivacy ) . map ( ( rule ) => (
71
74
< MenuItem key = { rule } value = { rule } >
72
75
{ capitalise ( shoutSnakeToLowerCase ( rule ) ) }
73
76
</ MenuItem >
0 commit comments