-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscriptupdatedBackend2.js
41 lines (34 loc) · 1.35 KB
/
scriptupdatedBackend2.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
import { getCookies } from "./inijs/cookies.js";
import { patchHeader } from "./inijs/api.js";
import { updateBackend } from "./inijs/gudangAPI.js";
export default function editBackend(){
let tokenkey = "token";
let tokenvalue = getCookies("login");
let npm = parseInt(document.getElementById('npm').value);
let nama = document.getElementById('nama').value;
let autentikasitoken = document.getElementById('autentikasitoken').value;
let packagesendiri = document.getElementById('packagesendiri').value;
let endpointgcfjakarta = document.getElementById('endpointgcfjakarta').value;
let integrasiwamyid = document.getElementById('integrasiwamyid').value;
let status = document.getElementById('status').checked;
let datainjson = {
"npm": npm,
"nama": nama,
"autentikasitoken": autentikasitoken,
"packagesendiri": packagesendiri,
"endpointgcfjakarta": endpointgcfjakarta,
"integrasiwamyid": integrasiwamyid,
"status": status
};
patchHeader(updateBackend,datainjson,tokenkey,tokenvalue,responseFunction)
}
function responseFunction(result) {
if (result.status == true) {
alert('berhasil update')
console.log("Berhasil update")
window.location.href = "getBackend.html";
} else {
alert('gagal update')
console.log("Gagal")
}
}