@recruitnepal/shared-packages 1.8.7 → 1.8.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/api-client.d.ts
CHANGED
package/dist/api-client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-client.d.ts","sourceRoot":"","sources":["../src/api-client.ts"],"names":[],"mappings":"AAEA,wBAAgB,OAAO,CAAC,MAAM,EAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,QAElD;AAED,wBAAgB,UAAU,WAKzB;AAED,eAAO,MAAM,GAAG;;;mBAGD,MAAM
|
|
1
|
+
{"version":3,"file":"api-client.d.ts","sourceRoot":"","sources":["../src/api-client.ts"],"names":[],"mappings":"AAEA,wBAAgB,OAAO,CAAC,MAAM,EAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,QAElD;AAED,wBAAgB,UAAU,WAKzB;AAED,eAAO,MAAM,GAAG;;;mBAGD,MAAM;;;sBAGH,MAAM;;qBAEP,MAAM;;;sBAGL,MAAM;;qBAEP,MAAM;qBACN,MAAM;;;;iCAIM,MAAM;;;;;;qCAMF,MAAM;+CACI,MAAM;;CAEhD,CAAC"}
|
package/dist/api-client.js
CHANGED
|
@@ -12,7 +12,6 @@ export const API = {
|
|
|
12
12
|
vacancies: {
|
|
13
13
|
list: () => `${getBaseURL()}/vacancies`,
|
|
14
14
|
byId: (id) => `${getBaseURL()}/vacancies/${id}`,
|
|
15
|
-
intern: () => `${getBaseURL()}/intern/vacancies`,
|
|
16
15
|
},
|
|
17
16
|
savedVacancies: {
|
|
18
17
|
list: (page) => `${getBaseURL()}/saved/vacancies${page ? `?page=${page}` : ''}`,
|
|
@@ -7,7 +7,7 @@ type Config = {
|
|
|
7
7
|
limit?: number;
|
|
8
8
|
companyId?: string;
|
|
9
9
|
forceStatus?: string;
|
|
10
|
-
/** When true,
|
|
10
|
+
/** When true, adds type=intern to query (for Intern Nepal: vacancies?type=intern) */
|
|
11
11
|
isIntern?: boolean;
|
|
12
12
|
/** Optional token for authenticated requests */
|
|
13
13
|
token?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetAllVacancy.d.ts","sourceRoot":"","sources":["../../src/hooks/useGetAllVacancy.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAiB,gBAAgB,EAAc,MAAM,UAAU,CAAC;AAE5E,KAAK,IAAI,GAAG,KAAK,GAAG,OAAO,CAAC;AAE5B,KAAK,MAAM,GAAG;IACZ,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,
|
|
1
|
+
{"version":3,"file":"useGetAllVacancy.d.ts","sourceRoot":"","sources":["../../src/hooks/useGetAllVacancy.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAiB,gBAAgB,EAAc,MAAM,UAAU,CAAC;AAE5E,KAAK,IAAI,GAAG,KAAK,GAAG,OAAO,CAAC;AAE5B,KAAK,MAAM,GAAG;IACZ,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qFAAqF;IACrF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gDAAgD;IAChD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4FAA4F;IAC5F,YAAY,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC;CACvC,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB,CAAC;AAkBF,eAAO,MAAM,gBAAgB,GAAI,mHAU9B,MAAW;;;;;;;;;;iBAnBD,MAAM;kBACL,MAAM;kBACN,MAAM;kBACN,MAAM;iBACP,MAAM;cACT,MAAM;;CAiOf,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -17,6 +17,7 @@ export const useGetAllVacancy = ({ publicFetch = true, mode = 'all', page, limit
|
|
|
17
17
|
const statusParam = forceStatus ?? searchParams?.get('status') ?? '';
|
|
18
18
|
const status = statusParam === 'all' ? '' : statusParam;
|
|
19
19
|
const sortBy = searchParams?.get('sort') || '';
|
|
20
|
+
const typeParam = isIntern ? 'intern' : (searchParams?.get('type') || '');
|
|
20
21
|
const buildUnified = (pg, fallbackTotal = 0) => {
|
|
21
22
|
const p = pg?.page ?? 1;
|
|
22
23
|
const ps = pg?.pages ?? 1;
|
|
@@ -30,7 +31,7 @@ export const useGetAllVacancy = ({ publicFetch = true, mode = 'all', page, limit
|
|
|
30
31
|
prevPage: pv,
|
|
31
32
|
};
|
|
32
33
|
};
|
|
33
|
-
// Helper to build clean query string
|
|
34
|
+
// Helper to build clean query string (always uses /vacancies; type=intern when isIntern)
|
|
34
35
|
const buildQueryString = (pageNum, pageLimit) => {
|
|
35
36
|
const params = new URLSearchParams();
|
|
36
37
|
params.set('page', String(pageNum));
|
|
@@ -45,19 +46,20 @@ export const useGetAllVacancy = ({ publicFetch = true, mode = 'all', page, limit
|
|
|
45
46
|
params.set('companyId', companyIdParam);
|
|
46
47
|
if (status)
|
|
47
48
|
params.set('status', status);
|
|
49
|
+
if (typeParam)
|
|
50
|
+
params.set('type', typeParam);
|
|
48
51
|
if (sortBy) {
|
|
49
52
|
params.set('sortBy', 'created_at');
|
|
50
53
|
params.set('sortOrder', sortBy);
|
|
51
54
|
}
|
|
52
55
|
return params.toString();
|
|
53
56
|
};
|
|
54
|
-
const listBasePath = isIntern ? '/intern/vacancies' : '/vacancies';
|
|
55
57
|
const fetchPaged = async () => {
|
|
56
58
|
const p = page ?? 1;
|
|
57
59
|
const l = String(limit ?? urlLimit);
|
|
58
60
|
const queryString = buildQueryString(p, l);
|
|
59
61
|
const res = await apiRequest({
|
|
60
|
-
endpoint:
|
|
62
|
+
endpoint: `/vacancies?${queryString}&_t=${Date.now()}`,
|
|
61
63
|
method: 'GET',
|
|
62
64
|
token: publicFetch ? undefined : token,
|
|
63
65
|
});
|
|
@@ -96,7 +98,7 @@ export const useGetAllVacancy = ({ publicFetch = true, mode = 'all', page, limit
|
|
|
96
98
|
while (next) {
|
|
97
99
|
const queryString = buildQueryString(next, l);
|
|
98
100
|
const res = await apiRequest({
|
|
99
|
-
endpoint:
|
|
101
|
+
endpoint: `/vacancies?${queryString}`,
|
|
100
102
|
method: 'GET',
|
|
101
103
|
token: publicFetch ? undefined : token,
|
|
102
104
|
});
|
|
@@ -129,7 +131,7 @@ export const useGetAllVacancy = ({ publicFetch = true, mode = 'all', page, limit
|
|
|
129
131
|
const effectiveLimit = limit ?? urlLimit;
|
|
130
132
|
const rq = useQuery({
|
|
131
133
|
queryKey: [
|
|
132
|
-
|
|
134
|
+
'vacancies',
|
|
133
135
|
mode,
|
|
134
136
|
page ?? null,
|
|
135
137
|
effectiveLimit,
|
|
@@ -139,9 +141,9 @@ export const useGetAllVacancy = ({ publicFetch = true, mode = 'all', page, limit
|
|
|
139
141
|
companyIdParam,
|
|
140
142
|
statusParam,
|
|
141
143
|
sortBy,
|
|
144
|
+
typeParam,
|
|
142
145
|
publicFetch ? 'pub' : 'auth',
|
|
143
146
|
token ?? 'no-token',
|
|
144
|
-
isIntern,
|
|
145
147
|
],
|
|
146
148
|
queryFn: mode === 'paged' ? fetchPaged : fetchAll,
|
|
147
149
|
enabled: isReady,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@recruitnepal/shared-packages",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.8",
|
|
4
4
|
"description": "Shared hooks, API client, types and utils for Recruit Nepal (CV builder UI and preprocess stay in each repo)",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|