Skip to content

Commit

Permalink
fix(@dpc-sdp/ripple-tide-publication): fixed publication menu not sho…
Browse files Browse the repository at this point in the history
…wing after preview expires
  • Loading branch information
jeffdowdle authored and dylankelly committed Oct 31, 2023
1 parent 52d47f8 commit bd41710
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,16 @@ export const createPublicationIndexHandler = async (
}

const tokenCookie = getCookie(event, AuthCookieNames.ACCESS_TOKEN)
const accessTokenExpiry = parseFloat(
getCookie(event, AuthCookieNames.ACCESS_TOKEN_EXPIRY)
)
const isTokenExpired = accessTokenExpiry
? accessTokenExpiry < Date.now()
: true

const headers = {}

if (tokenCookie) {
if (tokenCookie && !isTokenExpired) {
headers['X-OAuth2-Authorization'] = `Bearer ${tokenCookie}`
}

Expand Down

0 comments on commit bd41710

Please sign in to comment.