Skip to content
This repository was archived by the owner on May 14, 2024. It is now read-only.

Conversation

@Gaffari02
Copy link

No description provided.

@profxed
Copy link

profxed commented Sep 4, 2018

Hi @Gaffari02, Because you submitted your all 3 homeworks in the same day and we didn't really get time for review them all.
I am going to ask for a changes that has been asked before by me or @remarcmij that we make sure you did understand the basics of what you have learned so far.

@Gaffari02
Copy link
Author

Hello@ JawharBairakdar,
Firstly, I would like to thank you for the effort that you have spent in order to give me feedback. I will try my best to fix the parts that you and @remarcmij asked me.
Thanks..

@Gaffari02
Copy link
Author

Hello@ JawharBairakdar and @remarcmij ,
I have fixed the things that you asked for in my js3 homeworks. I still have a small problem which I couldnt fix. when I open the browser with error codes the head and select parts still appears. I tried a lot but I didn't find a solution. All the other things completed.

Thanks.
Gaffari

@remarcmij
Copy link
Contributor

HI @Gaffari02, the solution is probably simpler than you think. You just need to postpone creating the select element and container divs until after the initial call to fetchJSON(). If this call is successful, then you know there is no error and you can continue creating elements. In case of an error you render your error message instead, e.g.:

async function main(url) {

  const root = document.getElementById('root', { class: "root" });
  const div = createAndAppend('div', root, { class: "headbox" });
  const heading = createAndAppend('heading', div, { html: "HYF Repositories", class: "heading" });

  try {

    const repositories = await fetchJSON(url)

    const select = createAndAppend('select', div, { class: "select" });
    const divContainers = createAndAppend('div', root, { class: "div-containers" });
    const leftContainer = createAndAppend('div', divContainers, { class: "container" });
    const rightContainer = createAndAppend('div', divContainers, { class: "right-container" });
    //...
   }
   catch (err) {
     createAndAppend('div', root, { html: err.message, class: 'alert-error' });
   }
}

@profxed profxed added reviewed and removed reviewed labels Sep 13, 2018
@Gaffari02
Copy link
Author

HI @remarcmij , as you said the solution was simpler than I think. I postponed creating the headbox, heading, select and container divs until after the initial call to fetchJSON().
Finally it is done. Please let me know if anything else should be completed.
Thanks for both of your kindly helps @remarcmij @JawharBairakdar

Copy link
Contributor

@remarcmij remarcmij left a comment

Choose a reason for hiding this comment

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

Hi @Gaffari02, thanks for your final update. I'll approve your PR now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants