diff --git a/getFrontend.js b/getFrontend.js
index b1440f1..c955e9c 100644
--- a/getFrontend.js
+++ b/getFrontend.js
@@ -1,25 +1,39 @@
-// Fetch all products from the server
function getFrontend() {
- fetch('https://asia-southeast2-testlogin-366704.cloudfunctions.net/getallfe')
+ var myHeaders = new Headers();
+ var tokenvalue = getCookie("login")
+ myHeaders.append("token", tokenvalue);
+ var requestOptions = {
+ headers: myHeaders,
+ method: 'GET',
+ redirect: 'follow'
+ };
+
+ fetch('https://asia-southeast2-testlogin-366704.cloudfunctions.net/getallfee', requestOptions)
.then(response => response.json())
.then(data => {
if (data.status === true) {
- displayProducts(data.data);
+ // Display username (assuming the first element in the data array has the username)
+ const username = data.username;
+ console.log('Username:', username);
+
+ // Display products in the table
+ displayProducts(data.data,username);
} else {
console.error('Failed to fetch products');
}
})
.catch(error => console.error('Error:', error));
-}
-
-// Display products in the table
-function displayProducts(products) {
- const tableBody = document.getElementById('productTableBody');
- tableBody.innerHTML = '';
-
- products.forEach(product => {
+ }
+
+ // Display products in the table
+ function displayProducts(products,username) {
+ const tableBody = document.getElementById('productTableBody');
+ tableBody.innerHTML = '';
+
+ products.forEach(product => {
const row = document.createElement('tr');
row.innerHTML = `
+
${username} |
${product.Npm} |
${product.Nama} |
${product.Rilisjs} |
@@ -36,3 +50,19 @@ function displayProducts(products) {
// Fetch and display products on page load
window.onload = getFrontend;
+
+function getCookie(cname) {
+ let name = cname + "=";
+ let decodedCookie = decodeURIComponent(document.cookie);
+ let ca = decodedCookie.split(';');
+ for(let i = 0; i < ca.length; i++) {
+ let c = ca[i];
+ while (c.charAt(0) == ' ') {
+ c = c.substring(1);
+ }
+ if (c.indexOf(name) == 0) {
+ return c.substring(name.length, c.length);
+ }
+ }
+ return "";
+ }
\ No newline at end of file
diff --git a/inijs/content/createFrontend.js b/inijs/content/createFrontend.js
index 362ecd1..0abe105 100644
--- a/inijs/content/createFrontend.js
+++ b/inijs/content/createFrontend.js
@@ -1,13 +1,13 @@
import { postBiasa } from "../api.js";
import { getValue } from "../element.js";
import { createFrontend } from "../gudangAPI.js";
-import { getCookie } from "../cookies.js";
+import { getCookies } from "../cookies.js";
export default function createFrontendFix(){
// tokenstring = getCookie("token")
let tokenkey = "token";
- let tokenvalue = getCookie("token");
+ let tokenvalue = getCookies("login");
let datainjson = {
@@ -27,7 +27,7 @@ function responseData(result) {
if (result.status == true) {
alert("Berhasil Input Data");
- window.location.href = "../getFrontend.html";
+ window.location.href = "https://repo.if.ulbi.ac.id/sidang/getFrontend.html";
}else{
alert('gagal input data');
console.log("gagal");
diff --git a/inijs/gudangAPI.js b/inijs/gudangAPI.js
index 0145278..11083b5 100644
--- a/inijs/gudangAPI.js
+++ b/inijs/gudangAPI.js
@@ -3,7 +3,7 @@ export let APIAuthorizationAdmin = "https://asia-southeast2-testlogin-366704.clo
export let adminloginbaru = "https://asia-southeast2-testlogin-366704.cloudfunctions.net/loginp3";
-export let createFrontend = "https://asia-southeast2-testlogin-366704.cloudfunctions.net/createfe";
+export let createFrontend = "https://asia-southeast2-testlogin-366704.cloudfunctions.net/createfee";
export let createBackend = "https://asia-southeast2-testlogin-366704.cloudfunctions.net/createbee";
export let upadateFrontend = "https://asia-southeast2-testlogin-366704.cloudfunctions.net/updatefe";