Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Svenstar74 committed Sep 24, 2024
1 parent 8d74cd5 commit 172f396
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/pages/UserBPages/UserBSignUpPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ function UserBSignUpPage() {
const { signUp } = useSignUp();
const [isLoading, setIsLoading] = useState(false);
const devMode = localStorage.getItem('devMode') === 'true';

async function signUpHandler(firstName: string, lastName: string, email: string, password: string) {
setIsLoading(true);
const success = await signUp(firstName, lastName, email, password, quizId);
Expand All @@ -47,9 +48,7 @@ function UserBSignUpPage() {
<CmTypography variant="h1">Welcome to Climate Mind</CmTypography>

<div style={{ display: 'flex' }}>
<CmTypography variant="body" style={{ textAlign: 'center' }}>
Already have an account?
</CmTypography>
<CmTypography variant="body" style={{ textAlign: 'center' }}>Already have an account?</CmTypography>
<CmButton variant="text" text="Login" onClick={() => navigate(ROUTES.LOGIN_PAGE)} style={styles.loginButton} />
</div>
<div style={{ display: 'flex', flexDirection: 'column', gap: 19, justifyContent: 'center', alignItems: 'center' }}>
Expand Down
4 changes: 3 additions & 1 deletion src/shared/hooks/useApiClient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,14 @@ function useApiClient() {
if (sessionId) {
headers['X-Session-Id'] = sessionId;
}
//customCookies is used to set cookies (In this instance it is the refresh token) for the request and remove them after the request is done.

// customCookies is used to set cookies (In this instance it is the refresh token) for the request and remove them after the request is done.
if (customCookies) {
Object.entries(customCookies).forEach(([key, value]) => {
Cookies.set(key, value, { secure: true, sameSite: 'strict' });
});
}

// Get access token from cookies
let accessToken = Cookies.get('accessToken');
if (accessToken) {
Expand Down Expand Up @@ -134,6 +135,7 @@ function useApiClient() {
async function postRegister({ firstName, lastName, email, password, quizId }: requests.PostRegister) {
const response = await apiCall<responses.PostRegister>('post', '/register', {}, { firstName, lastName, email, password, quizId });
const accessToken = response.data.access_token;

// Store the access token for userA in cookies
if (response) {
if (!response) {
Expand Down

0 comments on commit 172f396

Please sign in to comment.