Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PB138 - Film Database Group Project
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tomáš Havlíček
PB138 - Film Database Group Project
Commits
7fc5ca10
There was an error fetching the commit references. Please try again later.
Commit
7fc5ca10
authored
2 years ago
by
Lukáš Kratochvíl
Browse files
Options
Downloads
Patches
Plain Diff
fix: SearchPage - more efficient inititial fetching of categories and directors
parent
40ba824a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
frontend/src/components/SearchPage.tsx
+7
-7
7 additions, 7 deletions
frontend/src/components/SearchPage.tsx
with
7 additions
and
7 deletions
frontend/src/components/SearchPage.tsx
+
7
−
7
View file @
7fc5ca10
...
...
@@ -65,11 +65,11 @@ export const SearchPage = () => {
useEffect
(()
=>
{
const
fetchData
=
async
()
=>
{
try
{
const
r
esponse
=
await
axiosConfig
.
get
<
CategoryIO
[]
>
('/categories');
setCategories([ ...response.data ]
);
const
catR
esponse
Promise
=
axiosConfig
.
get
<
CategoryIO
[]
>
('/categories');
const dirResponsePromise = axiosConfig.get
<
DirectorIO
[]
>
('/directors'
);
const dirResponse = await axiosConfig.get
<
DirectorIO
[]
>
('/directors'
);
setDirectors([ ...dirResponse.data ]);
setCategories([ ...((await catResponsePromise).data) ]
);
setDirectors([ ...
((await
dirResponse
Promise)
.data
)
]);
} catch
{
}
...
...
@@ -78,7 +78,6 @@ export const SearchPage = () => {
void fetchData();
}, []);
// here will be API call for search on BE, everything needed is in values
const onSubmit = async (values: IFormProps) =>
{
try
{
const
response
=
await
axiosConfig
.
get
<
MovieIO
[]
>
(
...
...
@@ -116,6 +115,7 @@ export const SearchPage = () => {
const onReset = () =>
{
form
.
resetFields
();
}
;
//columns stays the same
const columns = [
{
...
...
@@ -345,9 +345,9 @@ export const SearchPage = () => {
onRow
=
{
(
record
,
rowIndex
)
=>
{
return
{
onClick
:
(
event
)
=>
{
console
.
log
(
record
.
id
);
//remove later
console
.
log
(
record
.
id
);
//
TODO:
remove later
},
};
//here change to view movie
};
//
TODO:
here change to view movie
}
}
columns
=
{
columns
}
dataSource
=
{
resultMovies
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment