generated from cds-snc/project-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/add_dashboard
- Loading branch information
Showing
11 changed files
with
250 additions
and
165 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
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
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
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 |
---|---|---|
@@ -1,7 +1,6 @@ | ||
black==22.12.0 | ||
coverage==6.5.0 | ||
flake8==6.1.0 | ||
httpx==0.24.1 | ||
pytest==7.4.1 | ||
pytest==7.4.2 | ||
pytest-asyncio==0.21.1 | ||
pytest-env==0.8.2 |
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
Large diffs are not rendered by default.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -157,4 +157,4 @@ function App() { | |
} | ||
|
||
|
||
export default App; | ||
export default App; |
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,47 @@ | ||
import React, {useEffect, useState} from 'react'; | ||
|
||
export default function HomePage() { | ||
|
||
const [userData, setUserData] = useState(null); | ||
|
||
useEffect(() => { | ||
// Make a GET request to the "/user" endpoint | ||
fetch('/user') | ||
.then(response => { | ||
// Check if the response status code is OK (200) | ||
if (!response.ok) { | ||
throw new Error('Network response was not ok'); | ||
} | ||
// Parse the JSON response | ||
return response.json(); | ||
}) | ||
.then(data => { | ||
// Handle the JSON data from the response | ||
setUserData(data); | ||
}) | ||
.catch(error => { | ||
console.error('There was a problem with the fetch operation:', error); | ||
}); | ||
}, []); | ||
const googleLogout = () => { | ||
var logout_url= "/logout" | ||
window.location.href = logout_url | ||
} | ||
|
||
return ( | ||
<div> | ||
{userData ? ( | ||
<div> | ||
<h1 className="text-5xl font-bold">Welcome {userData.name}!</h1> | ||
<br></br> | ||
<p>This is the SRE Bot frontend dashboard. To log out, press the logout button.</p> | ||
<br></br> | ||
<button onClick={googleLogout} className="btn btn-xs sm:btn-sm md:btn-md lg:btn-lg border-zinc-950">Logout from Google</button> | ||
</div> | ||
) : ( | ||
<p>Error: Not logged in</p> | ||
)} | ||
</div> | ||
|
||
); | ||
} |
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