From 24147cba0f5723be3525e8f40d1954144841629b Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Thu, 13 May 2021 13:00:00 +0200 Subject: ui: Address technical dept in frontend --- opendc-web/opendc-web-ui/src/containers/auth/ProfileName.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'opendc-web/opendc-web-ui/src/containers/auth/ProfileName.js') diff --git a/opendc-web/opendc-web-ui/src/containers/auth/ProfileName.js b/opendc-web/opendc-web-ui/src/containers/auth/ProfileName.js index 291c0068..cbbe42b4 100644 --- a/opendc-web/opendc-web-ui/src/containers/auth/ProfileName.js +++ b/opendc-web/opendc-web-ui/src/containers/auth/ProfileName.js @@ -1,9 +1,13 @@ import React from 'react' -import { useSelector } from 'react-redux' +import { useUser } from '../../auth/hook' function ProfileName() { - const name = useSelector((state) => `${state.auth.givenName} ${state.auth.familyName}`) - return {name} + const user = useUser() + return ( + + {user.givenName} {user.familyName} + + ) } export default ProfileName -- cgit v1.2.3 From d9e65dceb38cdb8dc4e464d388755f9456620566 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Sun, 16 May 2021 17:07:58 +0200 Subject: ui: Restructure OpenDC frontend This change updates the structure of the OpenDC frontend in order to improve the maintainability of the frontend. --- opendc-web/opendc-web-ui/src/containers/auth/ProfileName.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'opendc-web/opendc-web-ui/src/containers/auth/ProfileName.js') diff --git a/opendc-web/opendc-web-ui/src/containers/auth/ProfileName.js b/opendc-web/opendc-web-ui/src/containers/auth/ProfileName.js index cbbe42b4..3992c00f 100644 --- a/opendc-web/opendc-web-ui/src/containers/auth/ProfileName.js +++ b/opendc-web/opendc-web-ui/src/containers/auth/ProfileName.js @@ -1,5 +1,5 @@ import React from 'react' -import { useUser } from '../../auth/hook' +import { useUser } from '../../auth' function ProfileName() { const user = useUser() -- cgit v1.2.3 From a6865b86cc8d710374fc0b6cfcbd2b863f1942a9 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Sun, 16 May 2021 23:18:02 +0200 Subject: ui: Migrate to Auth0 as Identity Provider This change updates the frontend codebase to move away from the Google login and instead use Auth0 as generic Identity Provider. This allows users to login with other accounts as well. Since Auth0 has a free tier, users can experiment themselves with OpenDC locally without having to pay for the login functionality. The code has been written so that we should be able to migrate away from Auth0 once it is not a suitable Identity Provider for OpenDC anymore. --- opendc-web/opendc-web-ui/src/containers/auth/ProfileName.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'opendc-web/opendc-web-ui/src/containers/auth/ProfileName.js') diff --git a/opendc-web/opendc-web-ui/src/containers/auth/ProfileName.js b/opendc-web/opendc-web-ui/src/containers/auth/ProfileName.js index 3992c00f..70f5b884 100644 --- a/opendc-web/opendc-web-ui/src/containers/auth/ProfileName.js +++ b/opendc-web/opendc-web-ui/src/containers/auth/ProfileName.js @@ -1,13 +1,9 @@ import React from 'react' -import { useUser } from '../../auth' +import { useAuth } from '../../auth' function ProfileName() { - const user = useUser() - return ( - - {user.givenName} {user.familyName} - - ) + const { isLoading, user } = useAuth() + return isLoading ? Loading... : {user.name} } export default ProfileName -- cgit v1.2.3