Avoided API calls
This commit is contained in:
parent
e349d2622c
commit
b0fd14d0bb
@ -48,7 +48,16 @@ const AttendancePage = () => {
|
|||||||
(msg) => {
|
(msg) => {
|
||||||
console.log("Equal:", selectedProject == msg.projectId);
|
console.log("Equal:", selectedProject == msg.projectId);
|
||||||
if (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]
|
[selectedProject, attrecall]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user