|
|
@ -120,7 +120,7 @@ class Login extends Component { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
getDataMenu = async (token, role_id, hierarchy, user_id, company_id, role_name, all_project, user_name) => { |
|
|
|
getDataMenu = async (token, role_id, hierarchy, user_id, company_id, role_name, all_project, user_name, configApp) => { |
|
|
|
const config = { |
|
|
|
const config = { |
|
|
|
headers: |
|
|
|
headers: |
|
|
|
{ |
|
|
|
{ |
|
|
@ -156,7 +156,8 @@ class Login extends Component { |
|
|
|
company_id, |
|
|
|
company_id, |
|
|
|
role_name, |
|
|
|
role_name, |
|
|
|
all_project, |
|
|
|
all_project, |
|
|
|
user_name |
|
|
|
user_name, |
|
|
|
|
|
|
|
configApp |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
@ -174,7 +175,8 @@ class Login extends Component { |
|
|
|
company_id, |
|
|
|
company_id, |
|
|
|
role_name, |
|
|
|
role_name, |
|
|
|
all_project, |
|
|
|
all_project, |
|
|
|
user_name |
|
|
|
user_name, |
|
|
|
|
|
|
|
configApp |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -242,7 +244,7 @@ class Login extends Component { |
|
|
|
if (doLogin && doLogin.data && doLogin.data.code === 200) { |
|
|
|
if (doLogin && doLogin.data && doLogin.data.code === 200) { |
|
|
|
const { access_token, data_user } = doLogin.data.data |
|
|
|
const { access_token, data_user } = doLogin.data.data |
|
|
|
this.getDataRole(access_token, data_user.role_id) |
|
|
|
this.getDataRole(access_token, data_user.role_id) |
|
|
|
this.getDataMenu(access_token, data_user.role_id, data_user.hierarchy, data_user.id, data_user.company_id, data_user.role.name, data_user.role.all_project, data_user.user_name) |
|
|
|
this.getDataMenu(access_token, data_user.role_id, data_user.hierarchy, data_user.id, data_user.company_id, data_user.role.name, data_user.role.all_project, data_user.user_name, data_user.configApp) |
|
|
|
window.localStorage.setItem('isLogin', true); |
|
|
|
window.localStorage.setItem('isLogin', true); |
|
|
|
window.localStorage.setItem('token', access_token); |
|
|
|
window.localStorage.setItem('token', access_token); |
|
|
|
window.localStorage.setItem('user_id', data_user.id); |
|
|
|
window.localStorage.setItem('user_id', data_user.id); |
|
|
@ -252,6 +254,7 @@ class Login extends Component { |
|
|
|
window.localStorage.setItem('role_name', data_user.role.name); |
|
|
|
window.localStorage.setItem('role_name', data_user.role.name); |
|
|
|
window.localStorage.setItem('all_project', data_user.role.all_project); |
|
|
|
window.localStorage.setItem('all_project', data_user.role.all_project); |
|
|
|
window.localStorage.setItem('hierarchy', JSON.stringify(data_user.hierarchy)); |
|
|
|
window.localStorage.setItem('hierarchy', JSON.stringify(data_user.hierarchy)); |
|
|
|
|
|
|
|
window.localStorage.setItem('configApp', JSON.stringify(data_user.configApp)); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
// NotificationManager.error('Cek username atau password anda!', 'Gagal Login!');
|
|
|
|
// NotificationManager.error('Cek username atau password anda!', 'Gagal Login!');
|
|
|
|
NotificationManager.error(doLogin.data.message, 'Login Failed!'); |
|
|
|
NotificationManager.error(doLogin.data.message, 'Login Failed!'); |
|
|
|