SOLUTION: Ivan Escribano and Alicia Cembranos#57
SOLUTION: Ivan Escribano and Alicia Cembranos#57ivan-escribano wants to merge 50 commits intoassembler-institute:mainfrom
Conversation
| function getDataComments(postId) { | ||
| const containerComments = document.getElementById("commentsContainer"); | ||
| containerComments.textContent = ""; | ||
| const commentsURL = `http://localhost:3000/comments`; |
There was a problem hiding this comment.
Create const variable on top --> More reusable code
| @@ -0,0 +1,611 @@ | |||
| //!GENERAL VARIABLES | |||
There was a problem hiding this comment.
Well structured in functions, will be a good idea to refactor code in more files
| postContainer.scrollTop + postContainer.clientHeight >= | ||
| postContainer.scrollHeight | ||
| ) { | ||
| createSkeleton(4); |
There was a problem hiding this comment.
Don't kill me please. Will be fine to declare 4 as a variable, to avoid magic number
| let idPost = post.id; | ||
| let imagePost = getImagesSplash(99); | ||
| removeSkeleton(); | ||
| createHTMLpostSection(imagePost, titlePost, usernamePost, idPost); |
There was a problem hiding this comment.
Love function name, super clear :)
| divsCarousel[0].classList.add("active"); | ||
| } | ||
|
|
||
| async function createHTMLsliderSection(image, title, id) { |
There was a problem hiding this comment.
Should it work without async? There is no promise inside function.
| carouselContent.append(div); | ||
| } | ||
|
|
||
| async function createHTMLpostSection(image, title, username, id) { |
There was a problem hiding this comment.
Same. Should async be written?
| //!GET IMAGE FROM UNSPLASH SOURCE | ||
| function getImagesSplash(index) { | ||
| const randomNumber = randomIndex(index); | ||
| const srcImages = `https://source.unsplash.com/16${randomNumber}x9${randomNumber}/`; |
There was a problem hiding this comment.
Should be a good idea to define URL on top, to have a more maintainable code
| } | ||
|
|
||
| async function fetchToServerPosts(id, info = true) { | ||
| const urlPost = `http://localhost:3000/posts/${id}`; |
There was a problem hiding this comment.
URL on top. Should this function be async? Not returning a value. I write a question, because we are not sure about it
| // const result = await responseDELETE.text(); | ||
| return false; | ||
| } catch (error) { | ||
| console.log(error); |
There was a problem hiding this comment.
We have used console.error(error), but we don't know what should be a better practice
| @@ -0,0 +1,611 @@ | |||
| //!GENERAL VARIABLES | |||
| @@ -0,0 +1,115 @@ | |||
| @import url("https://fonts.googleapis.com/css2?family=Amiri:ital,wght@0,400;0,700;1,400;1,700&family=Libre+Baskerville:wght@700&display=swap"); | |||


No description provided.