Skip to content

Commit

Permalink
Fix menu
Browse files Browse the repository at this point in the history
  • Loading branch information
sea-kg committed Jun 20, 2024
1 parent c8de63e commit 27d3398
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
13 changes: 11 additions & 2 deletions html/assets/js/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,16 @@ window.ctf01d_tp_api.auth_signin = function(auth_data) {
method: 'POST',
contentType: 'application/json',
data: JSON.stringify(auth_data),
});
});
}

window.ctf01d_tp_api.auth_signout = function(auth_data) {
return $.ajax({
url: '/api/v1/auth/signout',
method: 'POST',
contentType: 'application/json',
data: JSON.stringify(auth_data),
});
}

window.ctf01d_tp_api.auth_session = function (auth_data) {
Expand All @@ -39,7 +48,7 @@ window.ctf01d_tp_api.auth_session = function (auth_data) {
method: 'GET',
contentType: 'application/json',
data: JSON.stringify(auth_data),
});
});
}

window.ctf01d_tp_api.services_list = function() {
Expand Down
9 changes: 9 additions & 0 deletions html/assets/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,15 @@ function doSignin() {
})
}

function doSignOut() {
window.ctf01d_tp_api.auth_signout().fail(function(res) {
console.error(res);
}).done(function(res) {
showSuccessNotification('Sing out successfull!');
window.location.reload();
})
}

function renderGamesPage() {
$('.spa-web-page').css({"display": ""})
$('#games_page').css({"display": "block"})
Expand Down
13 changes: 11 additions & 2 deletions html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,17 @@
</ul>
<div class="form-inline my-2 my-lg-0">
<button id="btn_signin" class="btn-menu-top-left btn btn-outline-success my-2 my-sm-0" style="display: none" onclick="showLoginForm()">Sign-in</button>
<div id="btn_profile" class="btn-menu-top-left btn btn-outline-success my-2 my-sm-0" style="display: none">...</div>
<button id="btn_signout" class="btn-menu-top-left btn btn-outline-success my-2 my-sm-0" style="display: none" onclick="doSignOut()">Sign-out</button>
<div class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="btn_profile" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
User
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<div class="dropdown-item" id="btn_my_teams" onclick="showMyTeams()">My Team(s)</div>
<div class="dropdown-item" id="btn_my_services" onclick="showMyServices()">My Service(s)</div>
<div class="dropdown-divider"></div>
<div class="dropdown-item" id="btn_signout" onclick="doSignOut()">Sign-out</div>
</div>
</div>
</div>
</div>
</nav>
Expand Down

0 comments on commit 27d3398

Please sign in to comment.