Testes com api externa

This commit is contained in:
Hugo Falcao
2022-05-15 23:12:48 -03:00
parent 6b7ebe046a
commit e654b6a6b0
6 changed files with 192 additions and 206 deletions

15
src/store/Selectors.js Normal file
View File

@@ -0,0 +1,15 @@
import { createSelector } from 'reselect';
const getState = state => state;
// General getters
export const fetchRecords = createSelector(getState, state => state.records);
// More specific getters
export const fetchRecord = recordId => createSelector(getState, state => {
return state.records.filter(record => record.id === recordId)[0];
});
// export const getPoll = pollId => createSelector(getState, state => state.polls.filter(poll => poll.id === parseInt(pollId))[0]);
// export const getChat = contactId => createSelector(getState, state => state.chats.filter(c => parseInt(c.contact_id) === parseInt(contactId))[0].chats);
// export const getContact = contactId => createSelector(getState, state => state.contacts.filter(c => parseInt(c.id) === parseInt(contactId))[0]);