Merge pull request #61 from ente-io/remove_back_button_password_reset

remove back button from password set page
This commit is contained in:
Abhinav-grd 2021-05-07 13:05:00 +05:30 committed by GitHub
commit f23f827146
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 10 deletions

View file

@ -114,11 +114,16 @@ function SetPassword(props: Props) {
</Form>
)}
</Formik>
<div className="text-center" style={{ marginTop: '20px' }}>
<Button variant="link" onClick={props.back}>
{constants.GO_BACK}
</Button>
</div>
{props.back && (
<div
className="text-center"
style={{ marginTop: '20px' }}
>
<Button variant="link" onClick={props.back}>
{constants.GO_BACK}
</Button>
</div>
)}
</Card.Body>
</Card>
</Container>

View file

@ -3,7 +3,7 @@ import React, { useEffect, useState } from 'react';
import { slide as Menu } from 'react-burger-menu';
import billingService, { Subscription } from 'services/billingService';
import constants from 'utils/strings/constants';
import { getData, LS_KEYS } from 'utils/storage/localStorage';
import { getData, LS_KEYS, setData } from 'utils/storage/localStorage';
import { getToken } from 'utils/common/key';
import { getEndpoint } from 'utils/common/apiUtil';
import { Button } from 'react-bootstrap';
@ -214,7 +214,10 @@ export default function Sidebar(props: Props) {
</>
<LinkButton
style={{ marginTop: '30px' }}
onClick={() => router.push('changePassword')}
onClick={() => {
setData(LS_KEYS.SHOW_BACK_BUTTON, { value: true });
router.push('changePassword');
}}
>
{constants.CHANGE_PASSWORD}
</LinkButton>

View file

@ -1,6 +1,6 @@
import React, { useState, useEffect, useContext } from 'react';
import constants from 'utils/strings/constants';
import { getData, LS_KEYS } from 'utils/storage/localStorage';
import { getData, LS_KEYS, setData } from 'utils/storage/localStorage';
import { useRouter } from 'next/router';
import { getKey, SESSION_KEYS, setKey } from 'utils/storage/sessionStorage';
import { B64EncryptionResult } from 'services/uploadService';
@ -66,14 +66,21 @@ export default function Generate() {
);
setSessionKeys(key);
redirectToGallery();
};
const redirectToGallery = () => {
setData(LS_KEYS.SHOW_BACK_BUTTON, { value: false });
router.push('/gallery');
};
return (
<PasswordForm
callback={onSubmit}
buttonText={constants.CHANGE_PASSWORD}
back={() => router.push('/gallery')}
back={
getData(LS_KEYS.SHOW_BACK_BUTTON)?.value
? redirectToGallery
: null
}
/>
);
}

View file

@ -6,6 +6,7 @@ export enum LS_KEYS {
PLANS = 'plans',
IS_FIRST_LOGIN = 'isFirstLogin',
JUST_SIGNED_UP = 'justSignedUp',
SHOW_BACK_BUTTON = 'showBackButton',
}
export const setData = (key: LS_KEYS, value: object) => {