Skip to content

Commit

Permalink
[#723] Apply business logic to drep list
Browse files Browse the repository at this point in the history
  • Loading branch information
JanJaroszczak committed Apr 15, 2024
1 parent 773c9ca commit 97be7f5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions govtool/frontend/src/consts/dRepDirectory/sorting.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const DREP_DIRECTORY_SORTING = [
{
key: "NewestRegistered",
label: "Newest registered",
key: "RegistrationDate",
label: "Registration date",
},
{
key: "VotingPower",
Expand Down
6 changes: 3 additions & 3 deletions govtool/frontend/src/hooks/queries/useGetDRepListQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const useGetDRepListQuery = (
params?: GetDRepListParams,
options?: UseQueryOptions<DRepData[]>
) => {
const { drepView, sort, status } = params || {};
const { search, sort, status } = params || {};
const { pendingTransaction } = useCardano();

const { data, isLoading, isPreviousData } = useQuery<DRepData[]>({
Expand All @@ -19,12 +19,12 @@ export const useGetDRepListQuery = (
pendingTransaction.registerAsDrep ||
pendingTransaction.retireAsSoleVoter ||
pendingTransaction.retireAsDrep)?.transactionHash,
drepView,
search,
sort,
status,
],
queryFn: () => getDRepList({
...(drepView && { drepView }),
...(search && { search }),
...(sort && { sort }),
...(status && { status }),
}),
Expand Down
4 changes: 2 additions & 2 deletions govtool/frontend/src/pages/DRepDirectoryContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const DRepDirectoryContent: FC<DRepDirectoryContentProps> = ({

const { data: myDRepList } = useGetDRepListQuery(
{
drepView: currentDelegation?.startsWith("drep")
search: currentDelegation?.startsWith("drep")
? currentDelegation
: formHexToBech32(currentDelegation),
},
Expand All @@ -59,7 +59,7 @@ export const DRepDirectoryContent: FC<DRepDirectoryContentProps> = ({
const myDrep = myDRepList?.[0];
const { data: dRepList, isPreviousData } = useGetDRepListQuery(
{
drepView: debouncedSearchText,
search: debouncedSearchText,
sort: chosenSorting,
status: chosenFilters,
},
Expand Down
2 changes: 1 addition & 1 deletion govtool/frontend/src/services/requests/getDRepList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { DRepData } from "@models";
import { API } from "../API";

export type GetDRepListParams = {
drepView?: string;
search?: string;
sort?: string;
status?: string[];
};
Expand Down

0 comments on commit 97be7f5

Please sign in to comment.