Skip to content

Commit

Permalink
delete registration
Browse files Browse the repository at this point in the history
  • Loading branch information
jonnypaulino committed May 8, 2024
1 parent f34d1ae commit 6a6b9ae
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
24 changes: 22 additions & 2 deletions src/Pages/Users/ListUsers.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { Button } from "primereact/button";
import { Column } from "primereact/column";
import { DataTable } from "primereact/datatable";
import { useContext } from "react";
import { useContext, useState } from "react";
import { useNavigate } from "react-router-dom";
import UsersProvider, { UsersContext } from "../../Context/Users/context";
import { UsersTypes } from "../../Context/Users/type";
import { User, UsersTypes } from "../../Context/Users/type";
import { Container, Padding } from "../../Styles/styles";
import { ROLE } from "../../Controller/controllerGlobal";
import Loading from "../../Components/Loading";
import { ConfirmDialog } from "primereact/confirmdialog";

const ListUsers = () => {
return (
Expand All @@ -20,6 +21,8 @@ const ListUsers = () => {
const ListUsersPage = () => {
const props = useContext(UsersContext) as UsersTypes;
const history = useNavigate();

const [visible, setVisible] = useState<any>(false)
// const actionBodyTemplate = (rowData: any) => {

// return (
Expand Down Expand Up @@ -52,6 +55,12 @@ const ListUsersPage = () => {
);
};

const ActionsUserBody = (rowData: any) => {
return (
<Button severity="danger" icon={"pi pi-trash"} onClick={() => {setVisible(rowData)}} />
);
};

if (props.isLoading) return <Loading />;


Expand All @@ -66,7 +75,18 @@ const ListUsersPage = () => {
<Column field="username" header="Usuário"></Column>
<Column field="role" body={typeUserBody} header="Tipo"></Column>
<Column field="active" body={ActiveUserBody} header="Ativo"></Column>
{/* <Column field="actions" body={ActionsUserBody} header="Ações"></Column> */}

</DataTable>
<ConfirmDialog
visible={visible}
onHide={() => setVisible(false)}
message="Tem certeza de que deseja prosseguir?"
header="Confirmation"
icon="pi pi-exclamation-triangle"
accept={() => props.DeleteUser(visible?.id)}
reject={() => setVisible(false)}
/>
</Container>
);
};
Expand Down
2 changes: 1 addition & 1 deletion src/Services/PreRegistration/request.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export const requestRegistrationOneCpf = (cpf?: string) => {
};

export const requestDeleteRegistration = (id: number) => {
let path = "/registration/" + id;
let path = "/registration-token-bff/" + id;
return http
.delete(path)
.then(response => response.data)
Expand Down

0 comments on commit 6a6b9ae

Please sign in to comment.