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

[next] Fixes #1539: Porting DeleteFeedDialogButton to Next #1582

Merged
merged 4 commits into from Jan 22, 2021
Merged

[next] Fixes #1539: Porting DeleteFeedDialogButton to Next #1582

merged 4 commits into from Jan 22, 2021

Conversation

HyperTHD
Copy link
Contributor

@HyperTHD HyperTHD commented Jan 21, 2021

Issue This PR Addresses

Fixes #1539

Type of Change

  • Bugfix: Change which fixes an issue
  • New Feature: Change which adds functionality
  • Documentation Update: Change which improves documentation
  • UI: Change which improves UI

Description

This PR address #1539, which is the porting of the DeleteFeedDialogIcon button to next from gatsby. It is part of #1316 which is the transitioning of the telescope frontend.

Checklist

  • Quality: This PR builds and passes our npm test and works locally
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Screenshots: This PR includes screenshots or GIFs of the changes made or an explanation of why it does not (if applicable)
  • Documentation: This PR includes updated/added documentation to user exposed functionality or configuration variables are added/changed or an explanation of why it does not(if applicable)

humphd
humphd previously approved these changes Jan 21, 2021
const { id, url } = feed;
const classes = useStyles();
const { telescopeUrl } = useSiteMetadata();
const [open, setOpen] = useState<boolean>(false);
Copy link
Contributor

Choose a reason for hiding this comment

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

For inferred types like this, it's not necessary to include the generic <boolean>. Not wrong to do this, but not necessary.

const { telescopeUrl } = useSiteMetadata();
const [open, setOpen] = useState<boolean>(false);

const deleteBtnRef = useRef<HTMLButtonElement>(null);
Copy link
Contributor

Choose a reason for hiding this comment

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

Whereas this one is necessary, since we can't infer from null.

const removeFeed = async () => {
console.log(`Removing feed hosted at URL ${url}...`);
try {
const response = await fetch(`${telescopeUrl}/feeds/${id}`, { method: 'DELETE ' });
Copy link
Contributor

Choose a reason for hiding this comment

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

Stupid question but 'DELETE ' has an extra space in it, is it needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Definitely not, that's my fast typing lol

@chrispinkney
Copy link
Contributor

Also, is there any way to test this code? I imagine not right?

@HyperTHD
Copy link
Contributor Author

Not atm, this will need to be imported onto the corresponding components that use it in order to see if there's anything wrong with it

@yuanLeeMidori yuanLeeMidori merged commit d2c3e10 into Seneca-CDOT:master Jan 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: front-end area: nextjs Nextjs related issues type: enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[next] Port DeleteFeedDialogButton to NextJS
5 participants