index.ts 708 Bytes
import { gql } from '@apollo/client';
import apolloClient from '../../../store/apolloClient';

// eslint-disable-next-line import/prefer-default-export
export const FIND_FRANCHISE_PLAYERS = gql`
  query FindFranchisePlayers($franchiseId: String!) {
    findNflFranchisePlayers(filter: { franchiseId: { eq: $franchiseId } }) {
      nodes {
        id
        playerId
        franchiseId
        rosterSpotIndex
        buyPrice
      }
    }
  }
`;

export default async (franchiseId: string) => {
  try {
    await apolloClient.query({
      query: FIND_FRANCHISE_PLAYERS,
      variables: { franchiseId },
      fetchPolicy: 'network-only'
    });
    return null;
  } catch (e) {
    return null;
  }
};