diff --git a/src/components/UserPanel.vue b/src/components/UserPanel.vue
index 3ae05a268..691d3db8f 100644
--- a/src/components/UserPanel.vue
+++ b/src/components/UserPanel.vue
@@ -1,5 +1,5 @@
@@ -180,6 +188,7 @@ function copyUserToken() {
option-value="id"
input-debounce="0"
hide-selected
+ @update:model-value="localUserData"
/>
@@ -210,6 +220,7 @@ function copyUserToken() {
option-label="code"
option-value="id"
input-debounce="0"
+ @update:model-value="localUserData"
/>
saveUserData('warehouseFk', v)"
/>
@@ -232,6 +244,7 @@ function copyUserToken() {
style="flex: 0"
dense
input-debounce="0"
+ @update:model-value="(v) => saveUserData('companyFk', v)"
/>
diff --git a/src/composables/useState.js b/src/composables/useState.js
index 9b9c9d642..f20209494 100644
--- a/src/composables/useState.js
+++ b/src/composables/useState.js
@@ -11,6 +11,8 @@ const user = ref({
companyFk: null,
warehouseFk: null,
});
+if (sessionStorage.getItem('user'))
+ user.value = JSON.parse(sessionStorage.getItem('user'));
const roles = ref([]);
const tokenConfig = ref({});
@@ -25,7 +27,10 @@ export function useState() {
}
function setUser(data) {
- user.value = data;
+ const currentUser = { ...JSON.parse(sessionStorage.getItem('user')), ...data };
+ sessionStorage.setItem('user', JSON.stringify(currentUser));
+ user.value = currentUser;
+ return currentUser;
}
function getRoles() {