Skip to content

Commit

Permalink
Merge branch '689-authentication' into qa-one
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Schroer committed Feb 23, 2024
2 parents 6d646ee + 379cd02 commit 889f7eb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
6 changes: 5 additions & 1 deletion app/components/AppProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ export const AppProvider = ({
const newUserData = SessionCacher.getUserSignUpData();
if (newUserData && authState.isAuthenticated) {
SessionCacher.clearUserSignUpData();
AuthService.saveUser(newUserData, authState.user.id, authState.accessTokenObject.token);
AuthService.saveUser(
newUserData,
authState.user.id,
authState.accessTokenObject.token
);
}
}, [authState]);
console.log("config: ");
Expand Down
3 changes: 1 addition & 2 deletions app/pages/Auth/SignUpPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ export const SignUpPage = () => {
const [name, setName] = useState("");
const [organization, setOrganization] = useState("");
const authClient = useAppContext().authClient as WebAuth;
const { passwordlessStart, completeUserSignup } =
AuthService;
const { passwordlessStart, completeUserSignup } = AuthService;

const signUp = (evt: React.SyntheticEvent) => {
evt.preventDefault();
Expand Down
8 changes: 6 additions & 2 deletions app/utils/AuthService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export default class AuthService {
) => {
this.passwordlessLogin(authClient, email, verificationCode);
// Store user sign up data, which will be saved to our backend after Auth0 success redirect
SessionCacher.setUserSignUpData({email, name, organization});
SessionCacher.setUserSignUpData({ email, name, organization });
};

// This method initiates the log-in/sign-up process by sending a code
Expand Down Expand Up @@ -141,7 +141,11 @@ export default class AuthService {
authToken: string
) => {
return new Promise((resolve, reject) => {
const response = post("/api/users", {...userSignUpData, user_external_id: userExternalId}, {"Authorization": `Bearer ${authToken}`});
const response = post(
"/api/users",
{ ...userSignUpData, user_external_id: userExternalId },
{ Authorization: `Bearer ${authToken}` }
);
response.then(
(result) => {
resolve(result);
Expand Down

0 comments on commit 889f7eb

Please sign in to comment.