mirror of
https://github.com/trezor/trezor-suite.git
synced 2026-02-20 00:33:07 +01:00
fixup! chore(suite): remove unused THP actions
This commit is contained in:
@@ -285,9 +285,10 @@ const storageMiddleware = (api: MiddlewareAPI<Dispatch, AppState>) => {
|
||||
|
||||
if (
|
||||
deviceActions.setThpCredentials.match(action) ||
|
||||
thpActions.incrementCredentialConnectionCounter.match(action) ||
|
||||
thpActions.removeCredentials.match(action) ||
|
||||
action.type === 'device-thp_credentials_changed'
|
||||
action.type === 'device-thp_credentials_changed' ||
|
||||
(action.type === 'device-thp_pairing_status_changed' &&
|
||||
action.payload.status === 'finished')
|
||||
) {
|
||||
api.dispatch(storageActions.saveThpCredentials());
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { createAction } from '@reduxjs/toolkit';
|
||||
|
||||
import { ThpSuiteCredentials } from '@suite-common/suite-types';
|
||||
import { ThpCredentials } from '@trezor/protocol';
|
||||
|
||||
export const THP_PREFIX = '@suite/thp';
|
||||
@@ -11,13 +10,6 @@ const finishAutoconnectFlow = createAction(`${THP_PREFIX}/finish-autoconnect-flo
|
||||
|
||||
export const showAutoconnectInfo = createAction(`${THP_PREFIX}/showAutoconnectInfo`);
|
||||
|
||||
export const incrementCredentialConnectionCounter = createAction(
|
||||
`${THP_PREFIX}/increment-credential-connection-counter`,
|
||||
(payload: { credential: ThpSuiteCredentials }) => ({
|
||||
payload,
|
||||
}),
|
||||
);
|
||||
|
||||
export const addCredential = createAction(
|
||||
`${THP_PREFIX}/add-credential`,
|
||||
(payload: { credential: ThpCredentials }) => ({
|
||||
@@ -41,5 +33,4 @@ export const thpActions = {
|
||||
removeCredentials,
|
||||
removeAllCredentials,
|
||||
showAutoconnectInfo,
|
||||
incrementCredentialConnectionCounter,
|
||||
};
|
||||
|
||||
@@ -58,18 +58,6 @@ export const prepareThpReducer = createReducerWithExtraDeps<ThpState>(
|
||||
.addCase(thpActions.showAutoconnectInfo, state => {
|
||||
state.autoconnectStep = 'AutoconnectInfo';
|
||||
})
|
||||
.addCase(thpActions.incrementCredentialConnectionCounter, (state, { payload }) => {
|
||||
const credentialToUpdate = state.credentials.find(
|
||||
it => it.credential == payload.credential.credential,
|
||||
);
|
||||
|
||||
if (
|
||||
credentialToUpdate !== undefined &&
|
||||
credentialToUpdate.connectionCounter < CONNECTION_COUNTER_LIMIT
|
||||
) {
|
||||
credentialToUpdate.connectionCounter = credentialToUpdate.connectionCounter + 1;
|
||||
}
|
||||
})
|
||||
.addCase(thpActions.addCredential, (state, { payload }) => {
|
||||
state.credentials = addCredential(state.credentials, payload.credential);
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user