Estoy tratando de consultar Amplify para obtener datos de un punto final de graphQl. Estoy enviando los datos al backend con éxito. A continuación se muestra la solicitud de GraphQL
const getFixtures = async () => { const clubProfile = await DataStore.query(ClubProfile, c => c.id(userUuid)); setFixturesListData(clubProfile.fixtures); console.log('fixtures here', clubProfile); };La salida de la consola es: accesorios aquí [] (solo una matriz vacía)
El modelo es:
export declare class ClubProfile { readonly id: string; readonly club_email?: string | null; readonly club_name?: string | null; readonly club_number?: string | null; readonly club_description?: string | null; readonly club_website?: string | null; readonly club_teams?: string | null; readonly createdAt?: string | null; readonly updatedAt?: string | null; constructor(init: ModelInit<ClubProfile, ClubProfileMetaData>); static copyOf(source: ClubProfile, mutator: (draft: MutableModel<ClubProfile, ClubProfileMetaData>) => MutableModel<ClubProfile, ClubProfileMetaData> | void): ClubProfile; }Estoy probando diferentes opciones y sin éxito.
Cuando envío los datos al backend:
const clubInfo = async () => { let uuid = customerInfo.customerInfo.attributes.sub; const newClub = { id: uuid, club_name: clubName, club_email: clubEmail, club_number: clubPhone, club_location: clubLocation, club_website: 'https://www.clubWebsite.com', club_teams: {clubTeams}, club_description: 'clubDescription', }; await DataStore.save(new ClubProfile(newClub)); console.log('newClub', newClub); setNewClub(newClub); }; clubInfo(); }