mirror of
https://github.com/JanGross/quicknotes.git
synced 2025-11-30 23:37:16 +01:00
Set Last Modified to notes response..
This commit is contained in:
@@ -54,8 +54,13 @@ class NoteController extends Controller {
|
||||
$notes = $this->noteService->getAll($this->userId);
|
||||
$etag = md5(json_encode($notes));
|
||||
|
||||
$lastModified = new \DateTime(null, new \DateTimeZone('GMT'));
|
||||
$timestamp = max(array_map(function($note) { return $note->getTimestamp(); }, $notes));
|
||||
$lastModified->setTimestamp($timestamp);
|
||||
|
||||
$response = new JSONResponse($notes);
|
||||
$response->setETag($etag);
|
||||
$response->setLastModified($lastModified);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user