Added Note Sharing Links
This commit is contained in:
@@ -714,6 +714,30 @@ const mapRecordToNote = (r: any): Note => {
|
||||
};
|
||||
};
|
||||
|
||||
export const fetchNoteById = async (id: string): Promise<Note | null> => {
|
||||
try {
|
||||
const record = await pb.collection(NOTES_COLLECTION).getOne(id);
|
||||
if (!record) return null;
|
||||
return mapRecordToNote(record);
|
||||
} catch (err) {
|
||||
console.error("Failed to fetch note by ID:", err);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
export const updateStoreWithNote = (note: Note) => {
|
||||
setStore("notes", (currentNotes) => {
|
||||
const index = currentNotes.findIndex(n => n.id === note.id);
|
||||
if (index !== -1) {
|
||||
const newNotes = [...currentNotes];
|
||||
newNotes[index] = note;
|
||||
return newNotes;
|
||||
}
|
||||
return [...currentNotes, note];
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
// Helper to check if a task should be visible based on ownership, shares, or rules
|
||||
const shouldTaskBeVisible = (task: any, currentUserId: string): boolean => {
|
||||
// Own task
|
||||
|
||||
Reference in New Issue
Block a user