Add common.go_to_root for use as a callback function.
This commit is contained in:
		
							parent
							
								
									19d12c3132
								
							
						
					
					
						commit
						353b9eadaf
					
				
					 3 changed files with 8 additions and 2 deletions
				
			
		|  | @ -34,6 +34,12 @@ function is_wide_mode() | |||
|     return getComputedStyle(document.documentElement).getPropertyValue("--wide").trim() === "1"; | ||||
| } | ||||
| 
 | ||||
| common.go_to_root = | ||||
| function go_to_root() | ||||
| { | ||||
|     window.location.href = "/"; | ||||
| } | ||||
| 
 | ||||
| common.refresh = | ||||
| function refresh() | ||||
| { | ||||
|  |  | |||
|  | @ -5,7 +5,7 @@ | |||
|     <a class="header_element" href="/tags">Tags</a> | ||||
|     {% if session.user %} | ||||
|     <a class="header_element dynamic_user_display_name" href="/userid/{{session.user.id}}">{{session.user.display_name}}</a> | ||||
|     <button id="logout_button" class="header_element" onclick="return api.users.logout(common.refresh);" style="flex:0">Logout</button> | ||||
|     <button id="logout_button" class="header_element" onclick="return api.users.logout(common.go_to_root);" style="flex:0">Logout</button> | ||||
|     {% else %} | ||||
|     <a class="header_element" href="/login">Log in</a> | ||||
|     {% endif %} | ||||
|  |  | |||
|  | @ -141,7 +141,7 @@ function login_register_callback(response) | |||
|     } | ||||
|     else | ||||
|     { | ||||
|         window.location.href = "/"; | ||||
|         common.go_to_root(); | ||||
|     } | ||||
| } | ||||
| </script> | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue