diff --git a/rsconcept/frontend/src/backendAPI.ts b/rsconcept/frontend/src/backendAPI.ts index 79d6ad4e..f8cad1b3 100644 --- a/rsconcept/frontend/src/backendAPI.ts +++ b/rsconcept/frontend/src/backendAPI.ts @@ -3,6 +3,7 @@ import { config } from './constants' import { ErrorInfo } from './components/BackendError' import { toast } from 'react-toastify' import { ICurrentUser, IRSForm, IUserInfo, IUserProfile } from './models' +import { FilterType, RSFormsFilter } from './hooks/useRSForms' export type BackendCallback = (response: AxiosResponse) => void; @@ -69,10 +70,17 @@ export async function getActiveUsers(request?: IFrontRequest) { }); } -export async function getRSForms(request?: IFrontRequest) { +export async function getRSForms(filter: RSFormsFilter, request?: IFrontRequest) { + let endpoint: string = '' + if (filter.type === FilterType.PERSONAL) { + endpoint = `${config.url.BASE}rsforms?owner=${filter.data!}` + } else { + endpoint = `${config.url.BASE}rsforms?is_common=true` + } + AxiosGet({ title: `RSForms list`, - endpoint: `${config.url.BASE}rsforms/`, + endpoint: endpoint, request: request }); } diff --git a/rsconcept/frontend/src/components/Common/Checkbox.tsx b/rsconcept/frontend/src/components/Common/Checkbox.tsx index e5ccd1d6..c08a753c 100644 --- a/rsconcept/frontend/src/components/Common/Checkbox.tsx +++ b/rsconcept/frontend/src/components/Common/Checkbox.tsx @@ -6,7 +6,7 @@ interface CheckboxProps { required?: boolean disabled?: boolean widthClass?: string - value?: any + value?: boolean onChange?: (event: React.ChangeEvent) => void } @@ -17,7 +17,7 @@ function Checkbox({id, required, disabled, label, widthClass='w-full', value, on className='relative cursor-pointer peer w-4 h-4 shrink-0 mt-0.5 bg-white border rounded-sm appearance-none dark:bg-gray-900 checked:bg-blue-700 dark:checked:bg-orange-500' required={required} disabled={disabled} - value={value} + checked={value} onChange={onChange} />