summaryrefslogtreecommitdiffhomepage
path: root/gui/src
diff options
context:
space:
mode:
authorOskar Nyberg <oskar@mullvad.net>2020-06-05 12:14:01 +0200
committerOskar Nyberg <oskar@mullvad.net>2020-06-05 14:20:48 +0200
commit65e57168159c595134c05cf1be2dbb99b664ea5a (patch)
tree05577b547a5ab5d6c67bfdea326b0b898f8ce903 /gui/src
parent21ead666df0c5faafc4df4bd3b5c944dd7c95d0f (diff)
downloadmullvadvpn-65e57168159c595134c05cf1be2dbb99b664ea5a.tar.xz
mullvadvpn-65e57168159c595134c05cf1be2dbb99b664ea5a.zip
Remove use of spread operator for action data in reducers
Diffstat (limited to 'gui/src')
-rw-r--r--gui/src/renderer/redux/account/reducers.ts56
-rw-r--r--gui/src/renderer/redux/connection/reducers.ts12
-rw-r--r--gui/src/renderer/redux/version/reducers.ts5
3 files changed, 32 insertions, 41 deletions
diff --git a/gui/src/renderer/redux/account/reducers.ts b/gui/src/renderer/redux/account/reducers.ts
index bf2a87c6b5..8de7b2d07e 100644
--- a/gui/src/renderer/redux/account/reducers.ts
+++ b/gui/src/renderer/redux/account/reducers.ts
@@ -28,85 +28,63 @@ export default function (
case 'START_LOGIN':
return {
...state,
- ...{
- status: { type: 'logging in', method: 'existing_account' },
- accountToken: action.accountToken,
- },
+ status: { type: 'logging in', method: 'existing_account' },
+ accountToken: action.accountToken,
};
case 'LOGGED_IN':
return {
...state,
- ...{
- status: { type: 'ok', method: 'existing_account' },
- },
+ status: { type: 'ok', method: 'existing_account' },
};
case 'LOGIN_FAILED':
return {
...state,
- ...{
- status: { type: 'failed', method: 'existing_account', error: action.error },
- accountToken: undefined,
- },
+ status: { type: 'failed', method: 'existing_account', error: action.error },
+ accountToken: undefined,
};
case 'LOGGED_OUT':
return {
...state,
- ...{
- status: { type: 'none' },
- accountToken: undefined,
- expiry: undefined,
- },
+ status: { type: 'none' },
+ accountToken: undefined,
+ expiry: undefined,
};
case 'RESET_LOGIN_ERROR':
return {
...state,
- ...{
- status: { type: 'none' },
- },
+ status: { type: 'none' },
};
case 'START_CREATE_ACCOUNT':
return {
...state,
- ...{
- status: { type: 'logging in', method: 'new_account' },
- },
+ status: { type: 'logging in', method: 'new_account' },
};
case 'CREATE_ACCOUNT_FAILED':
return {
...state,
- ...{
- status: { type: 'failed', method: 'new_account', error: action.error },
- },
+ status: { type: 'failed', method: 'new_account', error: action.error },
};
case 'ACCOUNT_CREATED':
return {
...state,
- ...{
- status: { type: 'ok', method: 'new_account' },
- accountToken: action.token,
- expiry: action.expiry,
- },
+ status: { type: 'ok', method: 'new_account' },
+ accountToken: action.token,
+ expiry: action.expiry,
};
case 'UPDATE_ACCOUNT_TOKEN':
return {
...state,
- ...{
- accountToken: action.token,
- },
+ accountToken: action.token,
};
case 'UPDATE_ACCOUNT_HISTORY':
return {
...state,
- ...{
- accountHistory: action.accountHistory,
- },
+ accountHistory: action.accountHistory,
};
case 'UPDATE_ACCOUNT_EXPIRY':
return {
...state,
- ...{
- expiry: action.expiry,
- },
+ expiry: action.expiry,
};
}
diff --git a/gui/src/renderer/redux/connection/reducers.ts b/gui/src/renderer/redux/connection/reducers.ts
index 48a8f3f37f..31551d81ba 100644
--- a/gui/src/renderer/redux/connection/reducers.ts
+++ b/gui/src/renderer/redux/connection/reducers.ts
@@ -33,7 +33,17 @@ export default function (
): IConnectionReduxState {
switch (action.type) {
case 'NEW_LOCATION':
- return { ...state, ...action.newLocation };
+ return {
+ ...state,
+ ipv4: action.newLocation.ipv4,
+ ipv6: action.newLocation.ipv6,
+ country: action.newLocation.country,
+ city: action.newLocation.city,
+ latitude: action.newLocation.latitude,
+ longitude: action.newLocation.longitude,
+ hostname: action.newLocation.hostname,
+ bridgeHostname: action.newLocation.bridgeHostname,
+ };
case 'UPDATE_BLOCK_STATE':
return { ...state, isBlocked: action.isBlocked };
diff --git a/gui/src/renderer/redux/version/reducers.ts b/gui/src/renderer/redux/version/reducers.ts
index c0ecd22a8e..fcc23c7f3d 100644
--- a/gui/src/renderer/redux/version/reducers.ts
+++ b/gui/src/renderer/redux/version/reducers.ts
@@ -28,7 +28,10 @@ export default function (
case 'UPDATE_LATEST':
return {
...state,
- ...action.latestInfo,
+ nextUpgrade: action.latestInfo.nextUpgrade,
+ supported: action.latestInfo.supported,
+ latest: action.latestInfo.latest,
+ latestStable: action.latestInfo.latestStable,
};
case 'UPDATE_VERSION':