-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mm 006 creation api functions #10
Conversation
…rogress Co-authored-by: Dorothy Wong <[email protected]>
…rogress Co-authored-by: Dorothy Wong <[email protected]>
…rogress Co-authored-by: Dorothy Wong <[email protected]>
…rogress Co-authored-by: Dorothy Wong <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's looking really good - I've requested a couple of changes - mostly removing comments
.env.template
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you accidentally deleted this file - please can you recreate it - as it's needed for the codebase
src/App.tsx
Outdated
import './App.scss'; | ||
import Home from './Home/Home'; | ||
// line below is just an example of what to import to use the DisplayPictureOfDay function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove these comments and the the before merging - they might be confusing for some people
src/images/DisplayPicture.tsx
Outdated
|
||
const pictureData = await fetchAPI("https://api.nasa.gov/planetary/apod?api_key="); | ||
|
||
// test picture data for when the API requests have reached their limit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this from this PR as it's not for production.
src/images/DisplayPicture.tsx
Outdated
|
||
return myPictureData; | ||
|
||
// example of how to pick specific properties |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove these comments from this review for clarity
…ate 3.remove test data
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great - really nice work on this
##Description of changes - what did you do
added scripts:
script 1: utils/fetchData.ts to fetch API.
This function is reusable.
We implemented the use of the .env variable for the apiKey.
input:
a string for API url (without the final part containing the key) e.g. "https://api.nasa.gov/planetary/apod?api_key="
need a .env file in the root directory. inside the .env file, it should be something like this REACT_APP_NASA_API_KEY=""
output:
if there is error, return an error page. otherwise, return the JSON got from the API.
script 2: image/DisplayPicture.tsx to call fetchData
output (needs more work):
Option 1: if you return a React component (return (<>....</>) you can display specific properties of the Image of The Day.
You can render it as , the example can be found in App.tsx
Option 2: you can return the myPictureData instead (but we still are unsure about how to visualize it).
It will probably need another function so that the developer can choose what property to display accordingly to their need
##Things to Check
[ok ] Have all the requirements of your ticket have been met
[n/a] Have you added tests if needed for your ticket
[n/a ] Are all the tests passing