Skip to content

Commit

Permalink
Merge pull request #506 from ita-social-projects/#505-FixProfilesOrde…
Browse files Browse the repository at this point in the history
…rInLists

#505 [FE] Fix profiles order in lists
  • Loading branch information
Lvyshnevska authored Apr 6, 2024
2 parents 6c4cb7b + 5282e89 commit a5a90cc
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion FrontEnd/src/components/SearchPage/Search.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function Search({ isAuthorized }) {
};

const { data: companylist, error } = useSWR(
`${servedAddress}/api/search/?name=${searchTerm}`,
`${servedAddress}/api/search/?name=${searchTerm}&ordering=name`,
fetcher
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const MainCompanies = ({ isAuthorized }) => {
};

const { data: companylist } = useSWR(
`${baseUrl}/api/profiles/?new_members=-completeness,-created_at`,
`${baseUrl}/api/profiles/?ordering=-completeness,-created_at`,
fetcher
);

Expand Down
4 changes: 2 additions & 2 deletions FrontEnd/src/components/profileList/ProfileListPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ export default function ProfileListPage({ isAuthorized }) {
setCurrentPage(1);
}, [filter]);

const urlForAll = `${process.env.REACT_APP_BASE_API_URL}/api/profiles/?${profileFilter}&page=${currentPage}`;
const urlForAll = `${process.env.REACT_APP_BASE_API_URL}/api/profiles/?${profileFilter}&ordering=name&page=${currentPage}`;

const urlForSaved = `${
process.env.REACT_APP_BASE_API_URL
}/api/profiles/?${profileFilter}${
filterSaved ? '&is_saved=True' : ''
}&page=${currentPage}`;
}&ordering=-saved_at&page=${currentPage}`;

async function fetcher(url) {
return axios.get(url)
Expand Down
2 changes: 1 addition & 1 deletion FrontEnd/src/tests/MainCompanies.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ describe('MainCompanies component unit tests', () => {
</MemoryRouter>
);
expect(axios.get).toHaveBeenCalledWith(
'http://localhost:8000/api/profiles/?new_members=-completeness,-created_at'
'http://localhost:8000/api/profiles/?ordering=-completeness,-created_at'
);
const divElement = screen.getByText(/Нові учасники/i, { exact: false });
const onenameElement = screen.getByText(/saleonline/i, {
Expand Down

0 comments on commit a5a90cc

Please sign in to comment.