mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-11-26 16:52:06 +05:30
Fixes by review
This commit is contained in:
parent
00e74b1faf
commit
3b2fbb2cc4
@ -9,10 +9,8 @@ import DeleteAccount from './DeleteAccount';
|
||||
storiesOf('Components/Profile', module).add('DeleteAccount', () => (
|
||||
<ProfileLayout>
|
||||
<DeleteAccount
|
||||
onSubmit={() => {
|
||||
onSubmit={async () => {
|
||||
action('onSubmit')();
|
||||
|
||||
return Promise.resolve();
|
||||
}}
|
||||
/>
|
||||
</ProfileLayout>
|
||||
|
@ -11,23 +11,18 @@ const DeleteAccountPage: ComponentType = () => {
|
||||
const context = useContext(ProfileContext);
|
||||
const dispatch = useReduxDispatch();
|
||||
const { current: form } = useRef(new FormModel());
|
||||
const onSubmit = useCallback(
|
||||
() =>
|
||||
context
|
||||
.onSubmit({
|
||||
const onSubmit = useCallback(async () => {
|
||||
await context.onSubmit({
|
||||
form,
|
||||
sendData: () => deleteAccount(context.userId, form.serialize()),
|
||||
})
|
||||
.then(() => {
|
||||
});
|
||||
dispatch(
|
||||
updateUser({
|
||||
isDeleted: true,
|
||||
}),
|
||||
);
|
||||
context.goToProfile();
|
||||
}),
|
||||
[context],
|
||||
);
|
||||
}, [context]);
|
||||
|
||||
return <DeleteAccount onSubmit={onSubmit} />;
|
||||
};
|
||||
|
@ -125,7 +125,7 @@ describe('OAuth', () => {
|
||||
it('should allow sign in during oauth (guest oauth)', () => {
|
||||
cy.visit(`/oauth2/v1/ely?${new URLSearchParams(defaults)}`);
|
||||
|
||||
cy.url().should('include', '/login');
|
||||
cy.location('pathname').should('eq', '/login');
|
||||
|
||||
cy.get('[name=login]').type(`${account1.login}{enter}`);
|
||||
|
||||
@ -139,7 +139,7 @@ describe('OAuth', () => {
|
||||
it('should allow sign in during oauth and not finish process if the account is deleted', () => {
|
||||
cy.visit(`/oauth2/v1/ely?${new URLSearchParams(defaults)}`);
|
||||
|
||||
cy.url().should('include', '/login');
|
||||
cy.location('pathname').should('eq', '/login');
|
||||
|
||||
cy.get('[name=login]').type(`${account1.login}{enter}`);
|
||||
|
||||
@ -296,7 +296,7 @@ describe('OAuth', () => {
|
||||
|
||||
cy.findByTestId('auth-controls').contains('another account').click();
|
||||
|
||||
cy.url().should('include', '/login');
|
||||
cy.location('pathname').should('eq', '/login');
|
||||
|
||||
cy.get('[name=login]').type(`${account1.login}{enter}`);
|
||||
|
||||
@ -381,7 +381,7 @@ describe('OAuth', () => {
|
||||
})}`,
|
||||
);
|
||||
|
||||
cy.url().should('include', '/login');
|
||||
cy.location('pathname').should('eq', '/login');
|
||||
|
||||
cy.get('[name=login]').type(`${account1.login}{enter}`);
|
||||
|
||||
|
@ -214,7 +214,7 @@ describe('Sign in / Log out', () => {
|
||||
|
||||
cy.location('pathname').should('eq', '/accept-rules');
|
||||
|
||||
cy.findByTestId('auth-controls-secondary').contains('Decline and logout').click();
|
||||
cy.findByText('Decline and logout').click();
|
||||
|
||||
cy.location('pathname').should('eq', '/login');
|
||||
cy.findByTestId('toolbar').should('contain', 'Join');
|
||||
@ -255,7 +255,7 @@ describe('Sign in / Log out', () => {
|
||||
|
||||
cy.location('pathname').should('eq', '/accept-rules');
|
||||
|
||||
cy.findByTestId('auth-controls-secondary').contains('Delete account').click();
|
||||
cy.findByText('Delete account').click();
|
||||
|
||||
cy.location('pathname').should('eq', '/profile/delete');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user