-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAcounttype.js
49 lines (43 loc) · 1.28 KB
/
Acounttype.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
49
import {navbar,signin_navbar} from "../components/navbar.js"
let nav = document.getElementById('navbar')
let data=JSON.parse(localStorage.getItem('signinsatus'))
if(data ===true){
nav.innerHTML = signin_navbar()
}else{
nav.innerHTML = navbar();
}
let but1 = document.getElementById("job_seeker");
but1.onclick = () => {
getdata("job_seeker");
};
let but2 = document.getElementById("Employed");
but2.onclick = () => {
localStorage.setItem("Athorised", JSON.stringify("Employed"));
getdata("Employed");
};
let signinId = JSON.parse(localStorage.getItem("signinid"));
let url = "https://indeed-data.vercel.app/#";
let getdata = async (name) => {
let res = await fetch(url);
res = await res.json();
updatedata(signinId, name);
};
let returnornot = JSON.parse(localStorage.getItem("return"));
let updatedata = async (id, name) => {
data = { Athorised: name };
let res = await fetch(
`https://indeed-data.vercel.app/#/${id}`,
{
method: "PATCH",
body: JSON.stringify(data),
headers: {
"content-type": "application/json",
},
}
);
if (returnornot == "return") {
window.location.href = "setting.html";
} else {
window.location.href = "index.html";
}
};