Commit 4ec3cdf8 authored by Frauke's avatar Frauke

Added functionality for logout button

parent 5a972043
......@@ -9,10 +9,10 @@
<body>
<h1>Welcome to my.gent</h1>
<p>This is my personal space</p>
<form action="logout">
<form action="logout" id="logout">
<input type="submit" value="Log out">
</form>
<script src="js/vendor/OpenCrypto.js"></script>
<script src="js/script.js"></script>
<script src="js/logout.js"></script>
</body>
</html>
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
// Basic helper functions to directly write stuff to indexedDB through the browserAPI.
// Might be that we need to implement a shim for older browsers (shimIndexedDB)
function callOnStore (dbname, storeName, fn_) {
const indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB
// Open or create the database.
const request = indexedDB.open(dbname, 1)
// Create the schema
request.onupgradeneeded = () => {
let db = request.result
let store = db.createObjectStore(storeName, {keyPath: 'id'})
}
request.onsuccess = () => {
let db = request.result
let transaction = db.transaction(storeName, 'readwrite')
let store = transaction.objectStore(storeName)
fn_(store)
transaction.oncomplete = () => db.close()
}
}
module.exports = {
callOnStore
}
},{}],2:[function(require,module,exports){
const indexedDB = require('./indexedDB')
const form = document.getElementById('logout')
form.addEventListener('submit', (e) => {
e.preventDefault()
indexedDB.callOnStore('indienet', 'keyStore', (store) => {
store.clear()
document.cookie = 'access_token=; Max-Age=-99999999;'
window.location = '/sign-in'
})
})
},{"./indexedDB":1}]},{},[2]);
const indexedDB = require('./indexedDB')
const form = document.getElementById('logout')
form.addEventListener('submit', (e) => {
e.preventDefault()
indexedDB.callOnStore('indienet', 'keyStore', (store) => {
store.clear()
document.cookie = 'access_token=; Max-Age=-99999999;'
window.location = '/sign-in'
})
})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment