sr-npm 1.7.19 → 1.7.20

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.
@@ -1,12 +1,11 @@
1
1
  const { fetch } = require('wix-fetch');
2
2
  const { items: wixData } = require('@wix/data');
3
3
 
4
- async function makeSmartRecruitersRequest(path) {
4
+ async function makeSmartRecruitersRequest(path,token) {
5
5
  // const baseUrl = 'https://api.smartrecruiters.com'; // PROD
6
6
  const baseUrl = 'https://aoxley54.wixstudio.com/external-template/_functions'; // TEST
7
7
  const fullUrl = `${baseUrl}${path}`;
8
- const token = await getSmartTokenFromCMS();
9
- console.log("token is : ", token);
8
+
10
9
  //console.log(`Making request to: ${fullUrl}`);
11
10
  try {
12
11
  const response = await fetch(fullUrl, {
@@ -37,6 +36,7 @@ async function fetchPositionsFromSRAPI() {
37
36
  let nextPageId = null; // Start with no page ID for the first request
38
37
  let pageCount = 0;
39
38
  const MAX_PAGES = 30 // Safety limit to prevent infinite loops
39
+ const token = await getSmartTokenFromCMS();
40
40
 
41
41
  console.log('Starting to fetch all positions with pagination...');
42
42
 
@@ -51,7 +51,7 @@ async function fetchPositionsFromSRAPI() {
51
51
  }
52
52
 
53
53
  console.log(`Fetching page ${pageCount} with path: ${apiPath}`);
54
- const response = await makeSmartRecruitersRequest(apiPath);
54
+ const response = await makeSmartRecruitersRequest(apiPath,token);
55
55
 
56
56
  // Add positions from this page to our collection
57
57
  if (response.content && Array.isArray(response.content)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.7.19",
3
+ "version": "1.7.20",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {