@iankibetsh/shframework 5.4.5 → 5.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/library.js CHANGED
@@ -4160,7 +4160,7 @@ const useUserStore = pinia.defineStore('user-store', {
4160
4160
  loggedOut: false
4161
4161
  }),
4162
4162
  actions: {
4163
- setUser (){
4163
+ setUser (defaultEndpoint) {
4164
4164
  let user = null;
4165
4165
  try {
4166
4166
  user = shStorage.getItem('user') ? shStorage.getItem('user') : null;
@@ -4185,7 +4185,9 @@ const useUserStore = pinia.defineStore('user-store', {
4185
4185
  };
4186
4186
  }
4187
4187
  this.user = user;
4188
- shApis.doGet(vue.inject('userEndpoint')).then(res => {
4188
+ const userEndpoint = defaultEndpoint ?? vue.inject('userEndpoint','auth/user') ?? 'auth/user?defaults=1';
4189
+
4190
+ shApis.doGet(userEndpoint).then(res => {
4189
4191
  let user = res.data.user;
4190
4192
  if (typeof(user) === 'undefined') {
4191
4193
  user = res.data;
@@ -6085,6 +6087,7 @@ const setTab = (tab) => {
6085
6087
  }
6086
6088
  };
6087
6089
  const setTabCounts = (tabCounts) => {
6090
+ console.log('Setting tab counts', tabCounts);
6088
6091
  if (typeof tabCounts === 'object') {
6089
6092
  setCounts(tabCounts);
6090
6093
  } else {
@@ -6100,8 +6103,12 @@ const resetTabCounts = () => {
6100
6103
  } else {
6101
6104
  setTab(arr[arr.length - 1]);
6102
6105
  }
6106
+ let tbCounts = props.tabCounts;
6107
+ if(!tbCounts && typeof props.tabs[0] == 'object'){
6108
+ tbCounts = props.tabs;
6109
+ }
6103
6110
  if (props.tabCounts) {
6104
- setTabCounts(props.tabCounts);
6111
+ setTabCounts(tbCounts);
6105
6112
  }
6106
6113
  };
6107
6114
  const tabExistsInUrl = () => {
@@ -6116,6 +6123,7 @@ const tabExistsInUrl = () => {
6116
6123
  };
6117
6124
  const setCounts = (res) => {
6118
6125
  Object.keys(res).forEach(key => {
6126
+ console.log('Setting count for tab', key, res[key]);
6119
6127
  let elem = document.getElementsByClassName('sh_tab_' + key);
6120
6128
  if (elem.length > 0) {
6121
6129
  elem = elem[0];
@@ -7560,8 +7568,8 @@ const ShFrontend = {
7560
7568
  const noRecordsComponent = options.noRecordsComponent ?? script$k;
7561
7569
  const registrationFields = options.registrationFields ?? ['name','email','phone','password','password_confirmation'];
7562
7570
  const AuthComponent = options.authComponent ?? script;
7563
- const baseApiUrl = options.baseApiUrl ?? undefined.VITE_APP_API_URL;
7564
7571
  const userEndpoint = options.userEndpoint ?? 'auth/user';
7572
+ const baseApiUrl = options.baseApiUrl ?? undefined.VITE_APP_API_URL;
7565
7573
  app.provide('loginEndpoint',loginEndpoint);
7566
7574
  app.provide('registerEndpoint', registerEndpoint);
7567
7575
  app.provide('registrationFields', registrationFields);
package/dist/library.mjs CHANGED
@@ -4148,7 +4148,7 @@ const useUserStore = defineStore('user-store', {
4148
4148
  loggedOut: false
4149
4149
  }),
4150
4150
  actions: {
4151
- setUser (){
4151
+ setUser (defaultEndpoint) {
4152
4152
  let user = null;
4153
4153
  try {
4154
4154
  user = shStorage.getItem('user') ? shStorage.getItem('user') : null;
@@ -4173,7 +4173,9 @@ const useUserStore = defineStore('user-store', {
4173
4173
  };
4174
4174
  }
4175
4175
  this.user = user;
4176
- shApis.doGet(inject('userEndpoint')).then(res => {
4176
+ const userEndpoint = defaultEndpoint ?? inject('userEndpoint','auth/user') ?? 'auth/user?defaults=1';
4177
+
4178
+ shApis.doGet(userEndpoint).then(res => {
4177
4179
  let user = res.data.user;
4178
4180
  if (typeof(user) === 'undefined') {
4179
4181
  user = res.data;
@@ -6073,6 +6075,7 @@ const setTab = (tab) => {
6073
6075
  }
6074
6076
  };
6075
6077
  const setTabCounts = (tabCounts) => {
6078
+ console.log('Setting tab counts', tabCounts);
6076
6079
  if (typeof tabCounts === 'object') {
6077
6080
  setCounts(tabCounts);
6078
6081
  } else {
@@ -6088,8 +6091,12 @@ const resetTabCounts = () => {
6088
6091
  } else {
6089
6092
  setTab(arr[arr.length - 1]);
6090
6093
  }
6094
+ let tbCounts = props.tabCounts;
6095
+ if(!tbCounts && typeof props.tabs[0] == 'object'){
6096
+ tbCounts = props.tabs;
6097
+ }
6091
6098
  if (props.tabCounts) {
6092
- setTabCounts(props.tabCounts);
6099
+ setTabCounts(tbCounts);
6093
6100
  }
6094
6101
  };
6095
6102
  const tabExistsInUrl = () => {
@@ -6104,6 +6111,7 @@ const tabExistsInUrl = () => {
6104
6111
  };
6105
6112
  const setCounts = (res) => {
6106
6113
  Object.keys(res).forEach(key => {
6114
+ console.log('Setting count for tab', key, res[key]);
6107
6115
  let elem = document.getElementsByClassName('sh_tab_' + key);
6108
6116
  if (elem.length > 0) {
6109
6117
  elem = elem[0];
@@ -7548,8 +7556,8 @@ const ShFrontend = {
7548
7556
  const noRecordsComponent = options.noRecordsComponent ?? script$k;
7549
7557
  const registrationFields = options.registrationFields ?? ['name','email','phone','password','password_confirmation'];
7550
7558
  const AuthComponent = options.authComponent ?? script;
7551
- const baseApiUrl = options.baseApiUrl ?? import.meta.env.VITE_APP_API_URL;
7552
7559
  const userEndpoint = options.userEndpoint ?? 'auth/user';
7560
+ const baseApiUrl = options.baseApiUrl ?? import.meta.env.VITE_APP_API_URL;
7553
7561
  app.provide('loginEndpoint',loginEndpoint);
7554
7562
  app.provide('registerEndpoint', registerEndpoint);
7555
7563
  app.provide('registrationFields', registrationFields);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iankibetsh/shframework",
3
- "version": "5.4.5",
3
+ "version": "5.4.8",
4
4
  "description": "Vue library for handling laravel backend",
5
5
  "main": "dist/library.js",
6
6
  "module": "dist/library.mjs",