mirror of
https://github.com/whoswhip/Sharpbin.git
synced 2026-12-06 02:48:43 +00:00
Convert more authentication apis to controllers and session management
- Updated `AuthController.cs` to change unauthenticated response to `Unauthorized` and added a new `Logout` method for session handling. - Removed the old logout endpoint in `Program.cs` and centralized logout logic in `AuthController.cs`. - Added `GetSession` and `DeleteSession` methods in `DatabaseService.cs` to enhance session management. - Updated API endpoints in `dash.js` to reflect new routing structure for authorized account info and logout.
This commit is contained in:
@@ -13,7 +13,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
|
||||
async function fetchAccountInfo() {
|
||||
try {
|
||||
const response = await fetch('/api/accounts/authorized');
|
||||
const response = await fetch('/api/auth/authorized');
|
||||
|
||||
const accountData = await response.json();
|
||||
if (accountData.success === false) {
|
||||
@@ -212,7 +212,7 @@ function logout() {
|
||||
|
||||
document.getElementById('confirm-logout').onclick = async function () {
|
||||
try {
|
||||
await fetch('/api/accounts/logout', { method: 'POST'});
|
||||
await fetch('/api/auth/logout', { method: 'POST'});
|
||||
} catch { }
|
||||
window.location.href = '/login';
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user