31 lines
661 B
TypeScript
31 lines
661 B
TypeScript
import type { ActionReturnType } from '../../types';
|
|
|
|
import { addActionHandler } from '../../index';
|
|
|
|
addActionHandler('apiUpdate', (global, actions, update): ActionReturnType => {
|
|
switch (update['@type']) {
|
|
case 'updateTwoFaStateWaitCode': {
|
|
return {
|
|
...global,
|
|
twoFaSettings: {
|
|
...global.twoFaSettings,
|
|
isLoading: false,
|
|
waitingEmailCodeLength: update.length,
|
|
},
|
|
};
|
|
}
|
|
|
|
case 'updateTwoFaError': {
|
|
return {
|
|
...global,
|
|
twoFaSettings: {
|
|
...global.twoFaSettings,
|
|
error: update.message,
|
|
},
|
|
};
|
|
}
|
|
}
|
|
|
|
return undefined;
|
|
});
|