diff --git a/webapp/components/LoginForm/LoginForm.spec.js b/webapp/components/LoginForm/LoginForm.spec.js index 4dfdea50a..10fc2c622 100644 --- a/webapp/components/LoginForm/LoginForm.spec.js +++ b/webapp/components/LoginForm/LoginForm.spec.js @@ -73,8 +73,8 @@ describe('LoginForm', () => { describe('no categories saved', () => { it('resets the categories', async () => { await fillIn(Wrapper()) - expect(storeMocks.actions['auth/login']).toBeCalled() expect(storeMocks.mutations['posts/RESET_CATEGORIES']).toBeCalled() + expect(storeMocks.mutations['posts/TOGGLE_CATEGORY']).not.toBeCalled() }) }) @@ -82,7 +82,7 @@ describe('LoginForm', () => { it('sets the categories', async () => { authUserMock.mockReturnValue({ activeCategories: ['cat1', 'cat9', 'cat12'] }) await fillIn(Wrapper()) - expect(storeMocks.actions['auth/login']).toBeCalled() + expect(storeMocks.mutations['posts/RESET_CATEGORIES']).toBeCalled() expect(storeMocks.mutations['posts/TOGGLE_CATEGORY']).toBeCalledTimes(3) expect(storeMocks.mutations['posts/TOGGLE_CATEGORY']).toBeCalledWith({}, 'cat1') expect(storeMocks.mutations['posts/TOGGLE_CATEGORY']).toBeCalledWith({}, 'cat9') diff --git a/webapp/components/LoginForm/LoginForm.vue b/webapp/components/LoginForm/LoginForm.vue index ce2f3338b..59a6d7a24 100644 --- a/webapp/components/LoginForm/LoginForm.vue +++ b/webapp/components/LoginForm/LoginForm.vue @@ -99,12 +99,11 @@ export default { try { await this.$store.dispatch('auth/login', { email, password }) if (this.currentUser && this.currentUser.activeCategories) { + this.resetCategories() if (this.currentUser.activeCategories.length > 0) { this.currentUser.activeCategories.forEach((categoryId) => { this.toggleCategory(categoryId) }) - } else { - this.resetCategories() } } this.$toast.success(this.$t('login.success'))