@recruitnepal/shared-packages
v1.8.8
Published
Shared hooks, API client, types and utils for Recruit Nepal (CV builder UI and preprocess stay in each repo)
Downloads
1,894
Maintainers
Readme
@recruit-nepal/shared-packages
Shared UI components and hooks for Recruit Nepal projects.
Installation
npm install @recruit-nepal/shared-packages
# or
yarn add @recruit-nepal/shared-packagesSetup
Before using any API-related functionality, initialize the API client with your base URL:
import { initApi } from '@recruit-nepal/shared-packages';
// Initialize API client
initApi({
baseURL: process.env.NEXT_PUBLIC_API_BASE_URL || 'http://localhost:8000',
});Usage
Hook: useGetAllVacancy
import { useGetAllVacancy } from '@recruit-nepal/shared-packages';
function MyComponent() {
const { vacancies, isLoading, total, pagination } = useGetAllVacancy({
publicFetch: true,
mode: 'paged',
page: 1,
limit: 50,
token: 'your-auth-token', // Optional, required if publicFetch is false
});
// Use vacancies, isLoading, etc.
}Component: JobsClient
import { JobsClient } from '@recruit-nepal/shared-packages';
import { useGetAllVacancy } from '@recruit-nepal/shared-packages';
function JobsPage() {
const { vacancies, total } = useGetAllVacancy({
publicFetch: true,
mode: 'all',
});
return (
<JobsClient
initialVacancies={vacancies}
initialQuery=""
initialLocation=""
initialCategory=""
totalJobs={total}
// Optional: Provide custom components
headerComponent={YourCustomHeader}
jobListingComponent={YourCustomJobListing}
/>
);
}API Client
The API client provides a centralized way to manage API endpoints:
import { API, getBaseURL } from '@recruit-nepal/shared-packages';
// Get vacancy list endpoint
const vacanciesUrl = API.vacancies.list();
// Get specific vacancy endpoint
const vacancyUrl = API.vacancies.byId('123');
// Get base URL
const baseUrl = getBaseURL();Types
All TypeScript types are exported for use in your project:
import type {
SingleVacancyRes,
VacancyApiRes,
Pagination,
} from '@recruit-nepal/shared-packages';Development
# Build the package
npm run build
# Watch mode
npm run devPublishing
npm publish#� �r�e�c�r�u�i�t�-�s�h�a�r�e�d�-�p�a�c�k�a�g�e�s� � �#� �r�e�c�r�u�i�t�-�s�h�a�r�e�d�-�p�a�c�k�a�g�e�s� � �#� �r�e�c�r�u�i�t�-�s�h�a�r�e�d�-�p�a�c�k�a�g�e�s� � �