chore: Ability to change default account (#5393)
Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Co-authored-by: Tejaswini Chile <tejaswini@chatwoot.com>
This commit is contained in:
@@ -179,6 +179,14 @@ export const actions = {
|
||||
commit(types.SET_CURRENT_USER_AVAILABILITY, data[$state.currentUser.id]);
|
||||
}
|
||||
},
|
||||
|
||||
setActiveAccount: async (_, { accountId }) => {
|
||||
try {
|
||||
await authAPI.setActiveAccount({ accountId });
|
||||
} catch (error) {
|
||||
// Ignore error
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
// mutations
|
||||
|
||||
@@ -165,4 +165,15 @@ describe('#actions', () => {
|
||||
expect(commit.mock.calls).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#setActiveAccount', () => {
|
||||
it('sends correct mutations if account id is available', async () => {
|
||||
actions.setActiveAccount(
|
||||
{
|
||||
commit,
|
||||
},
|
||||
{ accountId: 1 }
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user