Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
peintnermax committed Jan 24, 2024
1 parent c73f31e commit 7f8f54b
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 142 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*

lib/node_modules
lib/node_modules
dist/
lib/dist/
1 change: 0 additions & 1 deletion lib/dist/lib/src/index.d.ts

This file was deleted.

1 change: 0 additions & 1 deletion lib/dist/lib/src/index.js

This file was deleted.

13 changes: 0 additions & 13 deletions lib/dist/lib/src/zitadelAuth.d.ts

This file was deleted.

33 changes: 0 additions & 33 deletions lib/dist/lib/src/zitadelAuth.js

This file was deleted.

11 changes: 0 additions & 11 deletions lib/dist/src/components/Callback.d.ts

This file was deleted.

48 changes: 0 additions & 48 deletions lib/dist/src/components/Callback.js

This file was deleted.

7 changes: 0 additions & 7 deletions lib/dist/src/components/Login.d.ts

This file was deleted.

17 changes: 0 additions & 17 deletions lib/dist/src/components/Login.js

This file was deleted.

9 changes: 9 additions & 0 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ button {
border: 1px solid #333333;
}

.user {
font-size: 1rem;
}

.user .description {
font-size: 1rem;
margin-bottom: 1rem;
}

@keyframes App-logo-spin {
from {
transform: rotate(0deg);
Expand Down
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function App() {
zitadel.signout();
}

const [authenticated, setAuthenticated] = useState<boolean>(false);
const [authenticated, setAuthenticated] = useState<boolean | null>(null);
const [userInfo, setUserInfo] = useState(null);

useEffect(() => {
Expand Down
14 changes: 6 additions & 8 deletions src/components/Callback.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { useEffect } from "react";

type Props = {
issuer: string;
authenticated: boolean;
setAuth: (authenticated: boolean) => void;
authenticated: boolean | null;
setAuth: (authenticated: boolean | null) => void;
userManager: any;
userInfo: any;
setUserInfo: any;
Expand All @@ -19,9 +19,8 @@ const Callback = ({
handleLogout,
}: Props) => {
useEffect(() => {
if (authenticated === false) {
userManager
.signinRedirectCallback()
if (authenticated === null || userInfo === null) {
userManager()
.then((user: any) => {
if (user) {
setAuth(true);
Expand All @@ -45,12 +44,11 @@ const Callback = ({
});
}
}, [authenticated, userManager, setAuth]);
console.log(authenticated, userInfo);
if (authenticated === true && userInfo) {
return (
<div>
<div className="user">
<h1>Welcome, {userInfo.name}!</h1>
<h2>Your ZITADEL Profile Information</h2>
<p className="description">Your ZITADEL Profile Information</p>
<h3>Name: {userInfo.name}</h3>
<h3>Email: {userInfo.email}</h3>
<h3>Email Verified: {userInfo.email_verified ? "Yes" : "No"}</h3>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Navigate } from "react-router-dom";

type Props = {
handleLogin: () => void;
authenticated: boolean;
authenticated: boolean | null;
};
const Login = ({ authenticated, handleLogin }: Props) => {
return (
Expand Down

0 comments on commit 7f8f54b

Please sign in to comment.