From 9f46a765859f170b2593e2af4864d90f4ca9f299 Mon Sep 17 00:00:00 2001 From: wahyuun Date: Fri, 10 Nov 2023 10:22:02 +0700 Subject: [PATCH] add props --- src/views/Dashboard/DashboardBOD.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/views/Dashboard/DashboardBOD.js b/src/views/Dashboard/DashboardBOD.js index 344faf5..74e64d0 100644 --- a/src/views/Dashboard/DashboardBOD.js +++ b/src/views/Dashboard/DashboardBOD.js @@ -13,8 +13,21 @@ import toRupiah from '@develoka/angka-rupiah-js'; import Icon from '@iconify/react'; import { HealthByBudget, HealthBySchedule } from './Components'; -const DashboardBOD = () => { - const token = localStorage.getItem("token") +const DashboardBOD = (props) => { + let role_id = '', user_id='',isLogin='',token=''; + if (props.location.state && props.location.state.role_id && props.location.state.user_id) { + role_id = props.location.state.role_id; + user_id = props.location.state.user_id; + token = props.location.state.token; + isLogin = props.location.state.isLogin; + console.log('props.location.state success'); + } else { + role_id = localStorage.getItem("role_id"); + user_id = localStorage.getItem("user_id"); + token = localStorage.getItem("token"); + isLogin = localStorage.getItem("isLogin"); + console.error('undefined in props.location.state'); + } const HEADER = { headers: { "Content-Type": "application/json",