1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2024-11-28 23:44:19 +00:00
pds-2021-g2-nest/nest_frontend/routes/PageUsers.js

46 lines
1.6 KiB
JavaScript
Raw Normal View History

2021-05-18 16:50:02 +00:00
import React, { useContext } from "react"
2021-05-11 17:42:04 +00:00
import BoxHeader from "../components/base/BoxHeader"
2021-05-11 21:27:42 +00:00
import BoxUserCreate from "../components/interactive/BoxUserCreate"
2021-05-12 02:10:36 +00:00
import useBackendViewset from "../hooks/useBackendViewset"
import BoxUserList from "../components/interactive/BoxUserList"
2021-05-18 16:50:02 +00:00
import ContextLanguage from "../contexts/ContextLanguage"
2021-05-25 02:06:14 +00:00
import PageWithHeader from "../components/base/layout/PageWithHeader"
import { faUserCog } from "@fortawesome/free-solid-svg-icons"
import makeIcon from "../utils/makeIcon"
import AlertError from "../components/interactive/AlertError"
import BodyHorizontalUpperGrow from "../components/base/layout/BodyHorizontalUpperGrow"
2021-05-11 17:42:04 +00:00
2021-05-25 02:09:47 +00:00
export default function PageUsers() {
2021-05-18 16:50:02 +00:00
const { strings } = useContext(ContextLanguage)
2021-05-25 02:06:14 +00:00
const {createResource, running, resources, destroyResource, error} = useBackendViewset("/api/v1/users/", "email")
2021-05-11 21:27:42 +00:00
2021-05-11 17:42:04 +00:00
return (
2021-05-25 02:06:14 +00:00
<PageWithHeader
header={
<BoxHeader>
{makeIcon(faUserCog)} {strings.manageUsers}
</BoxHeader>
}
>
<BodyHorizontalUpperGrow
upper={
<BoxUserList
users={resources}
destroyUser={destroyResource}
running={running}
/>
}
lower={
<BoxUserCreate
createUser={createResource}
running={running}
/>
}
error={error ? <AlertError error={error}/> : null}
/>
</PageWithHeader>
2021-05-11 17:42:04 +00:00
)
}