assets/scripts/core.js in bfdotcom-theme-0.2.8 vs assets/scripts/core.js in bfdotcom-theme-0.2.9
- old
+ new
@@ -20,12 +20,11 @@
signOut()
} else {
localStorage.setItem("accessKeyId", AWS.config.credentials.accessKeyId)
localStorage.setItem("secretAccessKey", AWS.config.credentials.secretAccessKey)
localStorage.setItem("sessionToken", AWS.config.credentials.sessionToken)
- var now = Date.now()
- localStorage.setItem("expiresAt", addMinutes(now, 60))
+ localStorage.setItem("expiresAt", addMinutes(Date.now(), 60).valueOf())
refreshSignedInStatus()
}
})
}
@@ -43,11 +42,11 @@
function refreshSignedInStatus() {
var accessKeyId = localStorage.getItem("accessKeyId")
var secretAccessKey = localStorage.getItem("secretAccessKey")
var sessionToken = localStorage.getItem("sessionToken")
- var expiresAt = localStorage.getItem("expiresAt")
+ var expiresAt = new Date(Number.parseInt(localStorage.getItem("expiresAt")))
var now = Date.now()
if (expiresAt !== null && expiresAt < now) {
// session was there, but has expired, so force a sign out
signOut()
@@ -170,10 +169,14 @@
var commentText = $('#commentText').val()
var userInfo = getUserInfo()
$('#submitButton').hide()
$('#commentBox').hide()
$('#submittingComment').show()
- var apigClient = apigClientFactory.newClient();
+ var apigClient = apigClientFactory.newClient({
+ accessKey: localStorage.getItem("accessKeyId"),
+ secretKey: localStorage.getItem("secretAccessKey"),
+ sessionToken: localStorage.getItem("sessionToken")
+ });
apigClient.commentsPost({}, {
"authorName": userInfo.name,
"authorEmail": userInfo.email,
"postUrl": window.location.pathname,
"comment": commentText