Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions data/company.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ export const companies = [
// },
// ],
// },
{
character: "a",
companyList: [
{
name: "amazon",
link: "https://www.naukri.com/amazon-overview-398058?tab=jobs&functionAreaIdGid=5&functionAreaIdGid=8&functionAreaIdGid=3&searchId=17022440542154303_17&src=orgCompanyListing",
},
],
},
{
character: "c",
companyList: [
Expand Down
14 changes: 14 additions & 0 deletions hooks/useCompany.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const useCompany = ({ company, url }: companyDataProps) => {
let response: companyObject[] = [];

if (company === "zoho" && !isLoading) {
console.log(data)
data.data.map((ele: any) => {
const jobName = ele.Job_Opening_Name.toLowerCase();
if (
Expand All @@ -39,6 +40,19 @@ export const useCompany = ({ company, url }: companyDataProps) => {
}
});
}
if (company === "amazon" && !isLoading) {
console.log(data)
data.data.map((ele: any) => {
const obj: companyObject = {
company: "Amazon",
title: ele.title,
link: ele.applyLink,
type: ele.experience,
location: ele.location,
};
response.push(obj);
});
}

if (company === "cred" && !isLoading) {
data.map((ele: any) => {
Expand Down
27 changes: 25 additions & 2 deletions libs/fetch.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
import axios from "axios";

const fetcher = (url: string) => axios.get(url).then((res) => res.data);
const fetcher = (url: string) => {
if(url.toLowerCase().includes("naukri.com")){
return fetch('/api/scraper', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ url: url }),
})
.then(response => response.json())
.then(data => {
if (data.success) {
return data;
} else {
console.error('Error:', data.error);
}
})
.catch(error => {
console.error('Fetch error:', error);
});
}
else{
return axios.get(url).then((res) => res.data)
}
};

export default fetcher;
Loading