Skip to content

Commit

Permalink
feat: private routes
Browse files Browse the repository at this point in the history
  • Loading branch information
Brunocrzz committed Jan 27, 2025
1 parent cf06af8 commit 1d9e695
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
9 changes: 4 additions & 5 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ function App() {
<Routes>
<Route path="*" element={<NotFound />} />
<Route path="/" element={<PrivateRoute><Home /></PrivateRoute>} />
<Route path="/login" element={<SignIn />} />
<Route path="/inicio" element={<Home />} />
{/* <PrivateRoute><Home /></PrivateRoute> <PrivateRoute><Users /></PrivateRoute>*/}
<Route path="/usuarios" element={<Users />} />
<Route path="/exportar-dados" element={<ExportarDados />} />
<Route path="/login" element={<PrivateRoute><SignIn /></PrivateRoute>} />
<Route path="/inicio" element={<PrivateRoute><Home /></PrivateRoute>} />
<Route path="/usuarios" element={<PrivateRoute><Users /></PrivateRoute>} />
<Route path="/exportar-dados" element={<PrivateRoute><ExportarDados /></PrivateRoute>} />
</Routes>
</BrowserRouter>
</AuthProvider>
Expand Down
10 changes: 8 additions & 2 deletions src/pages/ExportData/UserPopup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ import { useAuth } from '../../../hooks/useAuth';
import { InputGroup } from '../../../components/ui/input-group';
import { IoSearchOutline } from "react-icons/io5";

function UserPopup({ onSelectionChange, selectedUsers }: { onSelectionChange: (selectedUsers: string[]) => void, selectedUsers: string[] }) {
interface UserPopupProps {
onSelectionChange: (selectedUsers: string[]) => void;
selectedUsers: string[];
}

function UserPopup(props: Readonly<UserPopupProps>) {
const { onSelectionChange, selectedUsers } = props;
const [inputValue, setInputValue] = useState(''); //~ variavel que guard o valor do input

const [users, setUsers] = useState<User[]>([]);
Expand All @@ -41,7 +47,7 @@ function UserPopup({ onSelectionChange, selectedUsers }: { onSelectionChange: (s
const indeterminate = hasSelection && selection.length < usersCount

const handleSaveSelection = () => {
setSelection(selection);
setSelection((prevSelection) => [...prevSelection]);
onSelectionChange(selection);
toaster.create({
description: "Arquivo salvo com sucesso.",
Expand Down

0 comments on commit 1d9e695

Please sign in to comment.