Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions appengine/standard/iap/js/poll.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Copyright 2017 Google LLC

//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at

//
// http://www.apache.org/licenses/LICENSE-2.0

//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -21,13 +21,11 @@ function getStatus() {
if (response.ok) {
return response.text();
}
// [START handle_error]
// [START gae_handle_error]
if (response.status === 401) {
statusElm.innerHTML = 'Login stale. <input type="button" value="Refresh" onclick="sessionRefreshClicked();"/>';
}
// [END gae_handle_error]
// [END handle_error]
else {
statusElm.innerHTML = response.statusText;
}
Expand All @@ -43,7 +41,6 @@ function getStatus() {
getStatus();
setInterval(getStatus, 10000); // 10 seconds

// [START refresh_session]
// [START gae_refresh_session]
var iapSessionRefreshWindow = null;

Expand All @@ -65,7 +62,7 @@ function checkSessionRefresh() {
headers: {
'X-Requested-With': 'XMLHttpRequest'
}
.then((response) => {
.then((response) => {
// Checking if browser has a session for the requested app
if (response.status === 401) {
// No new session detected. Try to get a session again
Expand All @@ -82,4 +79,3 @@ function checkSessionRefresh() {
}
}
// [END gae_refresh_session]
// [END refresh_session]