Implement Option A (Live Job API), Option B (RSS Feed Aggregator), and Option C (Web Scraper Import API)
This commit is contained in:
+10
-1
@@ -57,7 +57,7 @@ export default function App() {
|
||||
const [isNewAppModalOpen, setIsNewAppModalOpen] = useState(false);
|
||||
const [walkthroughInitialUrl, setWalkthroughInitialUrl] = useState('');
|
||||
|
||||
// Initial Load from Firestore
|
||||
// Initial Load from Firestore & Live Job Feeds
|
||||
useEffect(() => {
|
||||
async function loadData() {
|
||||
try {
|
||||
@@ -72,6 +72,15 @@ export default function App() {
|
||||
|
||||
const notifs = await fetchNotifications();
|
||||
if (notifs.length > 0) setNotifications(notifs);
|
||||
|
||||
// Fetch live job feeds from APIs + RSS
|
||||
const feedsRes = await fetch('/api/jobs/fetch-feeds');
|
||||
if (feedsRes.ok) {
|
||||
const feedsData = await feedsRes.json();
|
||||
if (feedsData.success && Array.isArray(feedsData.jobs) && feedsData.jobs.length > 0) {
|
||||
setJobFeeds(prev => [...feedsData.jobs, ...prev]);
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn('Initial load fallback to initial dataset:', err);
|
||||
}
|
||||
|
||||
@@ -62,6 +62,18 @@ export const JobFeeds: React.FC<JobFeedsProps> = ({
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-2 text-xs font-semibold text-slate-300">
|
||||
<button
|
||||
onClick={async () => {
|
||||
const res = await fetch('/api/jobs/fetch-feeds');
|
||||
if (res.ok) {
|
||||
const data = await res.json();
|
||||
if (data.jobs) window.location.reload();
|
||||
}
|
||||
}}
|
||||
className="px-3 py-1.5 rounded-xl bg-indigo-600 hover:bg-indigo-500 text-white transition flex items-center gap-1.5 shadow-lg shadow-indigo-600/20"
|
||||
>
|
||||
<Rss className="w-3.5 h-3.5" /> Refresh Live Feeds (API & RSS)
|
||||
</button>
|
||||
<span className="px-3 py-1.5 rounded-xl bg-slate-800 border border-slate-700">
|
||||
Total Feeds: <strong className="text-indigo-400">{jobFeeds.length}</strong>
|
||||
</span>
|
||||
|
||||
Reference in New Issue
Block a user