-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #71 from JimTheCat/CU-8696ybq3g_Integrate-Frontend…
…-with-Backend_Patryk-Kosiski feature: Integrate FE with BE
- Loading branch information
Showing
24 changed files
with
437 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# .env.development | ||
VITE_API_URL=http://localhost:8080 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import {Button} from "@mantine/core"; | ||
import {IconLogout} from "@tabler/icons-react"; | ||
import {useAuthStore} from "../../../Services/authStore.ts"; | ||
import {useNavigate} from "react-router-dom"; | ||
|
||
export const LogOut = () => { | ||
|
||
const auth = useAuthStore(); | ||
const navigate = useNavigate(); | ||
|
||
return ( | ||
<Button | ||
variant={"subtle"} | ||
size={"md"} | ||
leftSection={<IconLogout/>} | ||
autoContrast | ||
fullWidth | ||
justify={"flex-start"} | ||
color={"gray"} | ||
onClick={() => { | ||
auth.logout(); | ||
navigate('/login'); | ||
}} | ||
> | ||
Wyloguj się | ||
</Button> | ||
); | ||
} |
Empty file.
16 changes: 16 additions & 0 deletions
16
frontend/src/Components/CenterContainer/CenterContainer.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import {Center, Flex} from "@mantine/core"; | ||
import React from "react"; | ||
|
||
type ICenterContainer = { | ||
children: React.ReactNode; | ||
} | ||
|
||
export const CenterContainer = (props: ICenterContainer) => { | ||
return ( | ||
<Center h={'100vh'}> | ||
<Flex direction={'column'} align={'center'} justify={'center'}> | ||
{props.children} | ||
</Flex> | ||
</Center> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './CenterContainer'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './InnerHtmlHandler'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import React from 'react'; | ||
import {Navigate, Outlet} from 'react-router-dom'; | ||
import {useAuthStore} from "../../Services/authStore.ts"; | ||
|
||
export const ProtectedRoute: React.FC = () => { | ||
const {token} = useAuthStore(); | ||
return token ? <Outlet/> : <Navigate to="/login"/>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './ProtectedRoute'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React from "react"; | ||
import {Navigate, Outlet} from "react-router-dom"; | ||
|
||
interface PublicRouteProps { | ||
isAuthenticated: boolean; | ||
redirectPath?: string; | ||
} | ||
|
||
export const PublicRoute: React.FC<PublicRouteProps> = ({isAuthenticated, redirectPath = "/mainpage",}) => { | ||
if (isAuthenticated) { | ||
return <Navigate to={redirectPath} replace/>; | ||
} | ||
return <Outlet/>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './PublicRoute'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './RichEditor'; |
Oops, something went wrong.