mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-04-01 02:41:39 -05:00
Added cache invalidation for products api
no refs - adding/changing products needs cache invalidation header otherwise frontend endpoints like `/members/api/site` use cached product data - adds cache invalidation for both add and edit endpoints for products
This commit is contained in:
parent
5c866fadde
commit
db50aa64d8
1 changed files with 10 additions and 0 deletions
|
@ -66,6 +66,9 @@ module.exports = {
|
|||
|
||||
add: {
|
||||
statusCode: 201,
|
||||
headers: {
|
||||
cacheInvalidate: true
|
||||
},
|
||||
validation: {
|
||||
data: {
|
||||
name: {required: true}
|
||||
|
@ -86,6 +89,7 @@ module.exports = {
|
|||
options: [
|
||||
'id'
|
||||
],
|
||||
headers: {},
|
||||
validation: {
|
||||
options: {
|
||||
id: {
|
||||
|
@ -99,6 +103,12 @@ module.exports = {
|
|||
frame.data,
|
||||
frame.options
|
||||
);
|
||||
|
||||
if (model.wasChanged()) {
|
||||
this.headers.cacheInvalidate = true;
|
||||
} else {
|
||||
this.headers.cacheInvalidate = false;
|
||||
}
|
||||
return model;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue