Avoided API calls
This commit is contained in:
parent
a3381bb2e6
commit
36d70b3850
@ -48,7 +48,16 @@ const AttendancePage = () => {
|
||||
(msg) => {
|
||||
console.log("Equal:", selectedProject == msg.projectId);
|
||||
if (selectedProject == msg.projectId) {
|
||||
attrecall();
|
||||
const updatedAttendance = attendances.map((item) =>
|
||||
item.employeeId === msg.response.employeeId
|
||||
? { ...item, ...msg.response }
|
||||
: item
|
||||
);
|
||||
cacheData("Attendance", {
|
||||
data: updatedAttendance,
|
||||
projectId: selectedProject,
|
||||
});
|
||||
setAttendances(updatedAttendance);
|
||||
}
|
||||
},
|
||||
[selectedProject, attrecall]
|
||||
|
Loading…
x
Reference in New Issue
Block a user