-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathaddnewteam.js
48 lines (40 loc) · 1.38 KB
/
addnewteam.js
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
let form = document.querySelector("#team_members");
let userteam = JSON.parse(localStorage.getItem("userteam")) || [];
form.addEventListener("submit", (event) => {
event.preventDefault();
let data = {
name: document.querySelector("#name").value,
number: document.querySelector("#nos").value,
}
if((data.name.length === 0) || (data.number.length === 0)){
alert("Fields cannot be empty");
} else {
userteam.push(data);
localStorage.setItem("userteam", JSON.stringify(userteam));
alert("New Team is created");
window.location.href = "myteams.html";
}
});
let userinfoas = JSON.parse(localStorage.getItem("userDetails"));
// setTimeout(() => {
let mainaccordin = document.getElementsByClassName("conBoxes");
for (i = 0; i < mainaccordin.length; i++) {
mainaccordin[i].addEventListener("click", function () {
this.classList.toggle("active");
// this.style.color ="blue"|| "black"
});
}
// }, 2000);
if (userinfoas === null) {
window.location.href = "../signup.html";
} else {
let nameprofile = document.getElementById("name-profile");
nameprofile.innerText = userinfoas["fullname"];
}
let profile = () => {
window.location.href = "../profile.html";
};
let profileSignout = () => {
localStorage.removeItem("userDetails");
window.location.href = "../signup.html";
};