Skip to content
Snippets Groups Projects
Commit 3a15a2b2 authored by Lukáš Kratochvíl's avatar Lukáš Kratochvíl
Browse files

feat: SearchPage - fetch result from the API - only non-relational attributes for now

parent 1c850d37
No related branches found
No related tags found
No related merge requests found
...@@ -80,7 +80,28 @@ export const SearchPage = () => { ...@@ -80,7 +80,28 @@ export const SearchPage = () => {
// here will be API call for search on BE, everything needed is in values // here will be API call for search on BE, everything needed is in values
const onSubmit = async (values: IFormProps) => { const onSubmit = async (values: IFormProps) => {
alert(JSON.stringify(values)); try {
const response = await axiosConfig.get<MovieIO[]>(
`/movies`,
{
params: {
name: values.name,
origName: values.originalName,
runtime: {
gte: values.runTimeMinutes[0],
lte: values.runTimeMinutes[1],
},
published: {
gte: values.publishedAt[0],
lte: values.publishedAt[1],
},
}
}
);
setResultMovies([ ...response.data ]);
} catch {
// TODO: on error
}
}; };
//function that happens when search button is pressed //function that happens when search button is pressed
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment