Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();

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)

Copy link
Author

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 !

const feed_url = event.target.elements.feed_url.value;
const Parser = require("rss-parser");
const parser = new Parser({
Expand All @@ -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 () => {
Expand Down Expand Up @@ -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}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use && operator !past && <p>Please enter an RSS feed</p>

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It just a cleaner way to do it !

<LoadingStatus fetching={onFetching} />

<EpisodeList
Expand Down
8 changes: 6 additions & 2 deletions src/components/SearchHistory.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 !== "")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can change the if statement to if (event.currentTarget.innerText)

Copy link
Author

Choose a reason for hiding this comment

The 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);
};

Expand Down