Closed
Description
maybe create a new query file for this, something like "useCoherentVotes":
import useSWR from "swr";
import { gql } from "graphql-request";
import { User } from "src/graphql/graphql";
export type { User };
const coherentVotesQuery = gql`
query User($id: ID) {
penalties {
degreeOfCoherency
}
}
`;
export const useCoherentVotes = (id: string): { data: typeof result; error: any; isValidating: boolean } => {
const { data, error, isValidating } = useSWR({
query: coherentVotesQuery,
variables: { id: id },
});
const result = data ? (data as User) : undefined;
return { data: result, error, isValidating };
};