feat: implement micro-learning system with content delivery components, completion tracking hooks, and database schema migrations
This commit is contained in:
17
src/hooks/useMicroLearnings.js
Normal file
17
src/hooks/useMicroLearnings.js
Normal file
@@ -0,0 +1,17 @@
|
||||
import pb from '../lib/pb';
|
||||
|
||||
export function useMicroLearnings() {
|
||||
const getMicroLearningsByTopic = async (topicId) => {
|
||||
try {
|
||||
const records = await pb.collection('micro_learnings').getFullList({
|
||||
filter: `topic_id = "${topicId}" && status = 'published'`,
|
||||
});
|
||||
return records;
|
||||
} catch (err) {
|
||||
console.error("Error fetching micro learnings:", err);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
||||
return { getMicroLearningsByTopic };
|
||||
}
|
||||
Reference in New Issue
Block a user