File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
packages/api-website-builder/src/context Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -22,11 +22,9 @@ export class WebsiteBuilder {
22
22
}
23
23
24
24
private invalidateCacheOnRedirectEvents ( ) {
25
- const invalidateRedirectsCache = new InvalidateRedirectsCache ( this . context . tasks ) ;
26
-
27
25
this . redirects . onRedirectAfterCreate . subscribe ( async ( { redirect } ) => {
28
26
if ( redirect . isEnabled ) {
29
- await invalidateRedirectsCache . execute ( ) ;
27
+ await this . invalidateCache ( ) ;
30
28
}
31
29
} ) ;
32
30
@@ -36,17 +34,22 @@ export class WebsiteBuilder {
36
34
redirect . redirectTo !== original . redirectTo ||
37
35
redirect . isEnabled !== original . isEnabled
38
36
) {
39
- await invalidateRedirectsCache . execute ( ) ;
37
+ await this . invalidateCache ( ) ;
40
38
}
41
39
} ) ;
42
40
43
41
this . redirects . onRedirectAfterDelete . subscribe ( async ( { redirect } ) => {
44
42
if ( redirect . isEnabled ) {
45
- await invalidateRedirectsCache . execute ( ) ;
43
+ await this . invalidateCache ( ) ;
46
44
}
47
45
} ) ;
48
46
}
49
47
48
+ private async invalidateCache ( ) {
49
+ const invalidateRedirectsCache = new InvalidateRedirectsCache ( this . context . tasks ) ;
50
+ await invalidateRedirectsCache . execute ( ) ;
51
+ }
52
+
50
53
get pages ( ) {
51
54
return this . pagesContext ! ;
52
55
}
You can’t perform that action at this time.
0 commit comments