Compare commits
1 Commits
18a84123d3
...
321dea202d
| Author | SHA1 | Date | |
|---|---|---|---|
| 321dea202d |
@@ -3,10 +3,9 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>React x Project</title>
|
||||
<title>Hangman Lab</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww</h2>
|
||||
<div id="root"></div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -4,6 +4,7 @@ import MainNavigation from "./components/MainNavigation";
|
||||
import SideNavigation from "./components/SideNavigation";
|
||||
import MarkdownContent from "./components/MarkdownContent";
|
||||
import "./App.css";
|
||||
import Callback from "./Callback";
|
||||
|
||||
const App = () => {
|
||||
return (
|
||||
@@ -16,6 +17,8 @@ const App = () => {
|
||||
<Routes>
|
||||
<Route path="/" element={<h1>Welcome to My React Project</h1>} />
|
||||
<Route path="/markdown/:id" element={<MarkdownContent />} />
|
||||
<Route path="/callback" element={<Callback />} />
|
||||
<Route path="/test" element={<h1>TEST</h1>}></Route>
|
||||
</Routes>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
@@ -21,7 +21,10 @@ const AuthProvider = ({ children }) => {
|
||||
});
|
||||
}, [userManager]);
|
||||
|
||||
const login = () => userManager.signinRedirect();
|
||||
const login = () => {
|
||||
console.log('triggered');
|
||||
userManager.signinRedirect().catch((err) => {console.log(err)});
|
||||
}
|
||||
const logout = () => userManager.signoutRedirect();
|
||||
|
||||
return (
|
||||
|
||||
@@ -16,18 +16,18 @@ const MainNavigation = () => {
|
||||
{ user && user.profile ? (
|
||||
<div>
|
||||
<h1>{user.profile.name}</h1>
|
||||
<button onClick={logout}>Logout</button>
|
||||
<Link to="/logout">Logout</Link>
|
||||
</div>
|
||||
) : (
|
||||
<button onClick={login}>Login</button>
|
||||
<li>
|
||||
<button onClick={login}>Login</button>
|
||||
</li>
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
<li>
|
||||
<Link to="/login">Login</Link>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://mail.hangman-lab.top" target="_blank" rel="noopener noreferrer">
|
||||
<a href="https://mail.hangman-lab.top" target="_blank" rel="noopener noreferrer">
|
||||
MailBox
|
||||
</a>
|
||||
</li>
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
import React from "react";
|
||||
import ReactDOM from "react-dom/client";
|
||||
import App from "./App";
|
||||
import AuthProvider from "./AuthProvider";
|
||||
|
||||
//ReactDOM.render(<App />, document.getElementById("root"));
|
||||
|
||||
const root = ReactDOM.createRoot(document.getElementById("root"));
|
||||
root.render(<App />);
|
||||
root.render(
|
||||
<AuthProvider>
|
||||
<App />
|
||||
</AuthProvider>
|
||||
);
|
||||
@@ -1,6 +1,6 @@
|
||||
export const oidcConfig = {
|
||||
authority: "https://login.hangman-lab.top/auth/realms/myrealm",
|
||||
client_id: "your-client-id",
|
||||
authority: "https://login.hangman-lab.top/realms/Hangman-Lab",
|
||||
client_id: "labdev",
|
||||
redirect_uri: "http://localhost:3000/callback",
|
||||
post_logout_redirect_uri: "http://localhost:3000",
|
||||
response_type: "code",
|
||||
|
||||
@@ -34,5 +34,6 @@ module.exports = {
|
||||
port: 3000,
|
||||
open: true,
|
||||
hot: true,
|
||||
historyApiFallback: true,
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user