Skip to content

Commit

Permalink
fix: signout trixta return initialState
Browse files Browse the repository at this point in the history
  • Loading branch information
jacques-trixta committed Aug 4, 2021
1 parent b644aa4 commit b8fbebd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@trixta/trixta-js",
"version": "4.1.2",
"version": "4.1.3",
"description": "Javascript library to integrate Trixta",
"source": "src/index.ts",
"main": "dist/@trixta/trixta-js.cjs.js",
Expand Down
8 changes: 6 additions & 2 deletions src/React/reducers/__tests__/reducers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,13 @@ describe('trixtaReducer', () => {
it('signoutTrixta should return the initial state', () => {
state = trixtaState;
const expectedResult = produce<TrixtaState>(state, (draft) => {
draft = initialState;
draft.actions = initialState.actions;
draft.error = initialState.error;
draft.reactions = initialState.reactions;
draft.authorizingStatus = initialState.authorizingStatus;
draft.authorizationStarted = initialState.authorizationStarted;
draft.agentDetails = initialState.agentDetails;
});

expect(trixtaReducer(state, signoutTrixta())).toEqual(expectedResult);
});

Expand Down
6 changes: 5 additions & 1 deletion src/React/reducers/trixtaReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ export const trixtaReducer = (
produce(state, (draft: Draft<TrixtaState>) => {
switch (action.type) {
case SIGN_OUT_TRIXTA:
draft = initialState;
draft.actions = initialState.actions;
draft.error = initialState.error;
draft.reactions = initialState.reactions;
draft.authorizingStatus = initialState.authorizingStatus;
draft.agentDetails = initialState.agentDetails;
break;
case channelActionTypes.CHANNEL_JOIN_ERROR:
{
Expand Down

0 comments on commit b8fbebd

Please sign in to comment.