You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
860 B
35 lines
860 B
import moment from "moment";
|
|
import { capitalize } from "../../../common/util/Util";
|
|
|
|
export async function viewUsers(authToken: string) {
|
|
// const users = await getOtherUsers(authToken);
|
|
|
|
const usersTable = $("#usersTable").DataTable({
|
|
ajax: {
|
|
url: "/api/admin/get/users",
|
|
headers: {
|
|
"X-AUTH-TOKEN": authToken,
|
|
},
|
|
dataSrc: "",
|
|
},
|
|
columns: [
|
|
{ data: "id" },
|
|
{ data: "userName" },
|
|
{
|
|
data: "role",
|
|
render: (data: string) => {
|
|
return capitalize(data.replace("_", " ").toLowerCase());
|
|
},
|
|
},
|
|
{
|
|
data: "joinDate",
|
|
render: (data: string, type) => {
|
|
return type === "sort"
|
|
? data
|
|
: moment.utc(data).format("DD/MM/YY").toString();
|
|
},
|
|
},
|
|
],
|
|
lengthMenu: [2, 10, 25, 50, 75, 100],
|
|
});
|
|
}
|