Skip to content

Commit

Permalink
Refresh the page at least once every 12 hours. Closes #196
Browse files Browse the repository at this point in the history
  • Loading branch information
dannyvankooten committed Oct 19, 2023
1 parent 4d5b8c2 commit ec27ec0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions assets/src/js/util/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,7 @@ export function request (path, opts = {}) {
return r
}).then(r => r.json())
}

// Nonces are valid for 24 hours, whereas WP Admin sessions can live for much longer.
// So here we reload the page every 12 hours so that we get a new X-WP-Nonce that is guaranteed to work.
window.setTimeout(window.location.reload, 12 * 3600);

0 comments on commit ec27ec0

Please sign in to comment.