- Complete the same process for the rest of the collections in order to pull the data for the appropriate collection; some collections may target different keys, which will change the `.get( )` function
- Each `.get ( )` will have its own Data file within src/helpers/data/
Dev Notes
db/teams.json
anddb/players.json
Example Data Structures Teams:
Players:
Also create
db/base.json
Import all files to firebase's database
To import the data to VS Code from Firebase, create `src/helpers/data/teamData.js
const baseUrl = apiKeys.firebaseKeys.databaseURL;
const getTeams = () => new Promise((resolve, reject) => { axios.get(
${baseUrl}/teams.json
) .then((result) => { const allTeamsObj = result.data; const teams = []; if (allTeamsObj != null) { Object.keys(allTeamsObj).forEach((teamId) => { const newTeam = allTeamsObj[teamId]; newTeam.id = teamId; teams.push(newTeam); }) } resolve(teams); }) .catch((error) => reject(error)); });export default { getTeams };