Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion aws-node-auth0-custom-authorizers-api/frontend/app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* global window document localStorage fetch alert */
/* eslint-env browser */

// Fill in with your values
const AUTH0_CLIENT_ID = 'your-auth0-client-id-here';
Expand Down
23 changes: 15 additions & 8 deletions aws-node-single-page-app-via-cloudfront/app/app.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,38 @@
/* eslint-disable */
/* eslint-env browser */
/* eslint-disable no-var */

// Renders the page based on the current URL
function renderApp() {
var content;
var main;

if (window.location.pathname === '/about') {
content = '<div>Welcome to the About page</div>'
content = '<div>Welcome to the About page</div>';
} else if (window.location.pathname === '/') {
content = '<div>Welcome Serverless Developer :)</div>'
content = '<div>Welcome Serverless Developer :)</div>';
}

var main = document.getElementsByTagName('main')[0];
main = document.getElementsByTagName('main')[0];
main.innerHTML = content;
}

// Navigate to another URL and re-render the application
function navigate(evt) {
var href;

evt.preventDefault();
var href = evt.target.getAttribute('href');
href = evt.target.getAttribute('href');
window.history.pushState({}, undefined, href);
renderApp();
}

document.addEventListener('DOMContentLoaded', function(event) {
function render(/* event */) {
// Attach the event listener once the DOM has been loaded
var nav = document.getElementsByTagName('nav')[0];
nav.addEventListener("click", navigate, false);
nav.addEventListener('click', navigate, false);

// First initial App rendering
renderApp();
});
}

document.addEventListener('DOMContentLoaded', render);