sr-npm 1.7.91 → 1.7.93

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.7.91",
3
+ "version": "1.7.93",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -3,7 +3,7 @@ const { getAllPositions } = require('../backend/queries');
3
3
  const {wixData} = require('wix-data');
4
4
  const { window } = require('@wix/site-window');
5
5
  //const { location,queryParams } = require('@wix/site-location');
6
- const { query,queryParams,to,wixLocationFrontend } = require("wix-location-frontend");
6
+ const { query,queryParams,to } = require("wix-location-frontend");
7
7
  const {
8
8
  debounce,
9
9
  getFilter,
@@ -15,12 +15,13 @@ const {
15
15
  const RESET_ALL = 'RESET_ALL';
16
16
  let pageParamSet=0;
17
17
  let thisObjectVar;
18
+ let queryPageVar;
19
+ let queryKeyWordVar;
18
20
 
19
21
 
20
-
21
-
22
- async function careersPageOnReady(_$w,thisObject) {
23
-
22
+ async function careersPageOnReady(_$w,thisObject,queryPage,queryKeyWord) {
23
+ queryPageVar=queryPage;
24
+ queryKeyWordVar=queryKeyWord;
24
25
  thisObjectVar=thisObject;
25
26
  allJobs=await getAllPositions();
26
27
  await handleUrlParams(_$w);
@@ -69,18 +70,20 @@ async function loadMoreJobs(_$w) {
69
70
 
70
71
  async function setPageParamInUrl() {
71
72
  console.log("query is: ", query);
72
- console.log("wixLocationFrontend.query is: ", wixLocationFrontend.query);
73
73
  console.log("query.page is: ", query.page);
74
74
  console.log(" is: ", Number(query.page) + 1);
75
+ if(!queryPageVar){
76
+ queryPageVar=1
77
+ }
75
78
 
76
- query.page ? queryParams.add({ page: Number(query.page) + 1 }) : queryParams.add({ page: 2 });
79
+ queryPageVar ? queryParams.add({ page: Number(queryPageVar) + 1 }) : queryParams.add({ page: 2 });
77
80
  }
78
81
  async function handleUrlParams(_$w) {
79
82
  // const query = await location.query();
80
- if (query.keyWord) {
81
- await handleKeyWordParam(_$w,query.keyWord);
83
+ if (queryKeyWordVar) {
84
+ await handleKeyWordParam(_$w,queryKeyWordVar);
82
85
  }
83
- if (query.page) {
86
+ if (queryPageVar) {
84
87
  await handlePageParam(_$w);
85
88
 
86
89
  }
@@ -95,20 +98,20 @@ async function handleKeyWordParam(_$w,keyWord) {
95
98
 
96
99
  async function handlePageParam(_$w) {
97
100
 
98
- if(allJobs.length/itemsPerPage<query.page){
101
+ if(allJobs.length/itemsPerPage<queryPageVar){
99
102
  console.log(`max page is: ${allJobs.length/itemsPerPage}`)
100
103
  queryParams.add({ page: allJobs.length/itemsPerPage })
101
104
  }
102
- if(query.page<=1){
105
+ if(queryPageVar<=1){
103
106
  console.log("min page is : 2")
104
107
  pageParamSet=2;
105
108
  queryParams.add({ page: 2 })
106
109
  }
107
- if (query.page) {
108
- pageParamSet=query.page;
110
+ if (queryPageVar) {
111
+ pageParamSet=queryPageVar;
109
112
  //scrolls a bit to load the dataset data
110
113
  await window.scrollTo(0, 200,{scrollAnimation:false});
111
- for (let i = 2; i <= query.page; i++) {
114
+ for (let i = 2; i <= queryPageVar; i++) {
112
115
  await _$w("#jobsDataset").loadMore();
113
116
  currentLoadedItems=currentLoadedItems+itemsPerPage
114
117
  }