-
Notifications
You must be signed in to change notification settings - Fork 189
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
Add Feeds needs to be now to be connected front end to back end #748
Conversation
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.
Thank you so much for your work on this! A few comments:
I'm having some trouble testing the POSTing functionality to due technical shortcomings (VM struggles to run a Gatsby development build plus Docker, etc). While I struggle with getting Docker Toolbox running, hopefully some other reviewers can cover for me, here. |
Alright, managed to configure my new environment. I finally was able to use this component to successfully POST a feed (RSS feed for Mozilla's blog), but attempting to handle that feed ended up causing my backend to crash: Any ideas, @c3ho? |
@Silvyre I just checked the dev tools thing, apparently using process.env.telescopeURL appends a weird /undefined in between the telescopeURL and /feeds route. So on my machine it became I hard coded the url and re-tested, it was displaying the proper output without crashing whatsoever. Also I don't know why but the front-end portion is unable to find |
src/frontend/src/pages/myfeeds.js
Outdated
|
||
async function addFeed() { | ||
try { | ||
const response = await fetch(`${process.env.telescopeUrl}/feeds/`, { |
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.
Here, telescopeUrl
should be replaced with API_URL
and provided with a default value.
For example, borrowing code from gatsby-config.js:
try {
const telescopeUrl = process.env.API_URL || `http://localhost:${process.env.PORT || 3000}`;
const response = await fetch(`${telescopeUrl}/feeds/`, {
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.
Agreed ^
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.
Now that I have a working environment, I can confirm that this feature does indeed work as intended!
I was able to add the aforementioned Mozilla feed and verify its addition by checking the /opml
route:
<outline text="60407f78e2" title="Mozilla's blog" type="rss" xmlUrl="https://blog.mozilla.org/rss" htmlUrl="https://blog.mozilla.org"/>
Great work!
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.
Just make that change, and it's an approve from me: #748 (comment)
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 got it working - but agreed with @Silvyre changes.
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.
Fantastic work! 👍 👍
How do I go about testing this? |
Here's how I tested:
|
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.
Wow this is neat! I added a feed for Cindy Cash for testing, how do I remove it? XD
We don't have a way to do that yet haha |
Provided you're running your own instance of Redis, your feed will disappear when you kill that instance. :) As @c3ho mentioned, we'll want to add functionality to the My Feeds page to remove added feeds in the future. |
Yeah, this is already causing problems. |
Merging as this was a rebase |
Issue This PR Addresses
Fixes #745
Type of Change
Description
Connected this to the back end, I had to repurpose the
+
button to add feeds for now! Sorry @Silvyre.Easiest way to test this is to just change the index.js under pages to display
myfeeds
component. To add a feed use the+
button after inputting name and feed info, make sure devTools is opened prior to clicking the button so you can evaluate the response from the server. A409
error means your feed already exists, to get around it just modify some of the characters for the blog url.Checklist