session sign out
parent
d350b7feff
commit
8b2e631e3e
|
@ -98,7 +98,7 @@ export default function SideMenu({ setUserSession }) {
|
||||||
setUserSession();
|
setUserSession();
|
||||||
window.location.href = "/";
|
window.location.href = "/";
|
||||||
|
|
||||||
fetch(Constants.API_ADDRESS + "/user/auth/logout", {
|
fetch(`${Constants.API_ADDRESS}/user/auth/logout`, {
|
||||||
method: "DELETE",
|
method: "DELETE",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
|
|
@ -28,7 +28,7 @@ export default function Login({ setUserSession }) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch(Constants.API_ADDRESS + "/user/auth/login", {
|
fetch(`${Constants.API_ADDRESS}/user/auth/login`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
|
|
|
@ -1,6 +1,12 @@
|
||||||
import { Badge, Space, Table } from "antd";
|
import { Badge, Button, Space, Table } from "antd";
|
||||||
import { useContext } from "react";
|
import { useContext } from "react";
|
||||||
import { FormatDatetime, WebSocketContext } from "../../utils";
|
import {
|
||||||
|
Constants,
|
||||||
|
FormatDatetime,
|
||||||
|
UseUserSession,
|
||||||
|
WebSocketContext,
|
||||||
|
} from "../../utils";
|
||||||
|
import { unstable_HistoryRouter } from "react-router-dom";
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
|
@ -27,11 +33,23 @@ const columns = [
|
||||||
title: "Action",
|
title: "Action",
|
||||||
dataIndex: "action",
|
dataIndex: "action",
|
||||||
key: "action",
|
key: "action",
|
||||||
render: (_, record) => (
|
render: (_, record) => {
|
||||||
<Space size="middle">
|
return (
|
||||||
<a>Sign out</a>
|
<Space size="middle">
|
||||||
</Space>
|
<a
|
||||||
),
|
onClick={() => {
|
||||||
|
fetch(`${Constants.API_ADDRESS}/user/session/${record.key}`, {
|
||||||
|
method: "DELETE",
|
||||||
|
}).catch((err) => {
|
||||||
|
console.error(err);
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Sign out
|
||||||
|
</a>
|
||||||
|
</Space>
|
||||||
|
);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -45,9 +63,9 @@ export default function UserProfile() {
|
||||||
(a, b) => b.ConnectionStatus - a.ConnectionStatus
|
(a, b) => b.ConnectionStatus - a.ConnectionStatus
|
||||||
);
|
);
|
||||||
|
|
||||||
webSocketContext.User.Sessions.forEach((session, index) => {
|
webSocketContext.User.Sessions.forEach((session) => {
|
||||||
items.push({
|
items.push({
|
||||||
key: "usersession" + index,
|
key: session.IdForDeletion,
|
||||||
userAgent: session.UserAgent,
|
userAgent: session.UserAgent,
|
||||||
connectionStatus:
|
connectionStatus:
|
||||||
session.ConnectionStatus === 0 ? (
|
session.ConnectionStatus === 0 ? (
|
||||||
|
|
Loading…
Reference in New Issue