-
Notifications
You must be signed in to change notification settings - Fork 38
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
Edit cors proxy
url in app
component
#43
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,11 +8,12 @@ import { | |
DialogTitle, | ||
} from "@material-ui/core"; | ||
|
||
import "./App.css"; | ||
import EpisodeList from "./components/EpisodeList"; | ||
import UserForm from "./components/UserForm"; | ||
import LoadingStatus from "./components/LoadingStatus"; | ||
|
||
import "./App.css"; | ||
|
||
const App = ({ fetching }) => { | ||
const [fetched, setFetched] = useState({}); | ||
const [onFetching, setFetching] = useState(false); | ||
|
@@ -22,8 +23,7 @@ const App = ({ fetching }) => { | |
|
||
const getFeed = (event) => { | ||
setFetching((prev) => !prev); | ||
if (event.preventDefault != null) | ||
event.preventDefault(); | ||
if (event.preventDefault != null) event.preventDefault(); | ||
const feed_url = event.target.elements.feed_url.value; | ||
const Parser = require("rss-parser"); | ||
const parser = new Parser({ | ||
|
@@ -32,7 +32,7 @@ const App = ({ fetching }) => { | |
}, | ||
}); | ||
|
||
const CORS_PROXY = "https://cors-anywhere.herokuapp.com/"; | ||
const CORS_PROXY = "https://cors.bridged.cc/"; | ||
|
||
if (feed_url) { | ||
const loadRSS = async () => { | ||
|
@@ -101,8 +101,8 @@ const App = ({ fetching }) => { | |
past={past} | ||
previous_feeds={[...previousFeeds]} | ||
/> | ||
{error ? renderAlert() : <div />} | ||
{!past ? <p>Please enter an RSS feed</p> : <div></div>} | ||
{error ? renderAlert() : null} | ||
{!past ? <p>Please enter an RSS feed</p> : null} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can use && operator There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It just a cleaner way to do it ! |
||
<LoadingStatus fetching={onFetching} /> | ||
|
||
<EpisodeList | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,8 +9,12 @@ export default function SearchHistory(props) { | |
}; | ||
|
||
const handleClose = (event) => { | ||
if (event.currentTarget.innerText != '') | ||
props.getFeed({target: {elements: {feed_url: {value: event.currentTarget.innerText}}}}); | ||
if (event.currentTarget.innerText !== "") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can change the if statement to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The same as #43 (comment) |
||
props.getFeed({ | ||
target: { | ||
elements: { feed_url: { value: event.currentTarget.innerText } }, | ||
}, | ||
}); | ||
setAnchorEl(null); | ||
}; | ||
|
||
|
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.
We can change the condition to be
if (event.preventDefault)
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 would be clear to compare it with
null
instead of implicitly assume that !