-
Notifications
You must be signed in to change notification settings - Fork 0
/
scratch
26 lines (22 loc) · 811 Bytes
/
scratch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
async function generateUserSubmitted(){
const token = localStorage.getItem("token");
const username = localStorage.getItem("username");
currentUser = await User.getLoggedInUser(token, username)
if (currentUser.ownStories.length === 0){
$("<h5>")
.text("You have no stories that you've submitted")
.appendTo($ownStories)
}else{
currentUser.ownStories.map(story => {generateStoryHTML(story,$ownStories,"✎")
$ownStories.on("click",".favorite",async(e)=>{
await User.editStory(e.target.parentElement.id);
console.log(e.target.parentElement.id)
})
})
}
}
$profile.on("click",async ()=>{
$allStoriesList.toggleClass("hidden")
$favDiv.toggleClass("hidden")
await generateUserSubmitted()
})