1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2024-11-24 14:04:19 +00:00
pds-2021-g2-nest/nest_frontend/routes/PageUsers.js
2021-05-25 15:30:11 +02:00

45 lines
1.6 KiB
JavaScript

import React, { useContext } from "react"
import BoxHeader from "../components/base/BoxHeader"
import BoxUserCreate from "../components/interactive/BoxUserCreate"
import useBackendViewset from "../hooks/useBackendViewset"
import BoxUserList from "../components/interactive/BoxUserList"
import ContextLanguage from "../contexts/ContextLanguage"
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"
export default function PageUsers() {
const { strings } = useContext(ContextLanguage)
const {createResource, running, resources, destroyResource, error} = useBackendViewset("/api/v1/users/", "email")
return (
<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>
)
}