<input type="text" onKeyPress={HandleKeyPress} value={text.id1} />
<input type="text2" onKeyPress={HandleKeyPress} value={text.id2} />
<input type="text3" onKeyPress={HandleKeyPress} value={text.id3} />
const HandleKeyPress = (event:React.KeyboardEvent<HTMLInputElement>) => {
if(event.key === 'Enter') {
dispatch( loadList{
type:viewType.search
})
) }}:
Slice.ts
export const loadList = createAsyncThunk(
'List/get',
async(request:LoadListRequest) => {
const response = await getTask(request);
return response.data;
}};
const getTask = (
const Getcall = return axios.get("/api/search/?(add optional params here ??)
I am able to call the API with react-redux-typescript implementation, but have to pass optional params to the Get API - add in URL like - api/save/?id1=1234&id2=456&id3=789
if the user enters all three then add them in URL separated by "&". and if the user enters only one then add only one in URL params.