dev1/MilestoneTracker.js

23 lines
725 B
JavaScript

// ...existing code...
const loadLastSelectedCareer = async () => {
try {
const token = localStorage.getItem('token');
if (!token) {
throw new Error('Authorization token is missing');
}
const response = await fetch('https://dev1.aptivaai.com:5002/api/premium/planned-path/latest', {
headers: { Authorization: `Bearer ${token}` }, // Fixed template literal syntax
});
const data = await response.json();
if (data?.id) {
setSelectedCareer(data.job_title);
setCareerPathId(data.id); // Store the career_path_id
loadMilestonesFromServer(data.id);
}
} catch (error) {
console.error('Error loading last selected career:', error);
}
};
// ...existing code...