Przeglądaj źródła

Added logout to dashboard

Pitu 8 lat temu
rodzic
commit
8ee1540c82
2 zmienionych plików z 11 dodań i 3 usunięć
  1. 4 3
      pages/panel.html
  2. 7 0
      public/js/panel.js

+ 4 - 3
pages/panel.html

@@ -42,18 +42,19 @@
                             <p class="menu-label">General</p>
                             <ul class="menu-list">
                                 <li><a href="/">Frontpage</a></li>
-                                <li><a id='itemUploads'>Uploads</a></li>
+                                <li><a onclick="panel.getUploads()">Uploads</a></li>
                             </ul>
                             <p class="menu-label">Albums</p>
                             <ul class="menu-list">
-                                <li><a id='itemManageGallery'>Manage your albums</a></li>
+                                <li><a onclick="panel.getAlbums()">Manage your albums</a></li>
                                 <li>
                                     <ul id='albumsContainer'></ul>
                                 </li>
                             </ul>
                             <p class="menu-label">Administration</p>
                             <ul class="menu-list">
-                                <li><a id="itemTokens">Change your tokens</a></li>
+                                <li><a onclick="panel.changeTokens()">Change your tokens</a></li>
+                                <li><a onclick="panel.logout()">Logout</a></li>
                             </ul>
                         </aside>
                     </div>

+ 7 - 0
public/js/panel.js

@@ -54,6 +54,7 @@ panel.prepareDashboard = function(){
 	document.getElementById('auth').style.display = 'none';
 	document.getElementById('dashboard').style.display = 'block';
 
+	/*
 	document.getElementById('itemUploads').addEventListener('click', function(){
 		panel.getUploads();
 	});
@@ -65,10 +66,16 @@ panel.prepareDashboard = function(){
 	document.getElementById('itemTokens').addEventListener('click', function(){
 		panel.changeTokens();
 	});
+	*/
 
 	panel.getAlbumsSidebar();
 }
 
+panel.logout = function(){
+	localStorage.removeItem("admintoken");
+	location.reload('/');
+}
+
 panel.getUploads = function(album = undefined, page = undefined){
 
 	if(page === undefined) page = 0;