Skip to content

Commit

Permalink
fix: fixes password out of date error messaging (#669)
Browse files Browse the repository at this point in the history
* fix: fixes password out of date error messaging

* fix: prod error fixes

* fix: test fix
  • Loading branch information
YazeedLoonat authored Feb 28, 2024
1 parent 652f5a1 commit 61a6b7f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
8 changes: 7 additions & 1 deletion api/src/services/listing.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ views.base = {
include: {
unitTypes: true,
unitAmiChartOverrides: true,
amiChart: true,
},
},
};
Expand Down Expand Up @@ -132,6 +131,13 @@ views.details = {
views.csv = {
...views.base,
...views.full,
units: {
include: {
unitTypes: true,
unitAmiChartOverrides: true,
amiChart: true,
},
},
userAccounts: true,
};

Expand Down
2 changes: 1 addition & 1 deletion api/src/utilities/unit-utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export const generateHmiData = (
? [
...new Set(
units
.filter((unit) => amiChartMap[unit.amiChart.id])
.filter((unit) => unit.amiChart && amiChartMap[unit.amiChart.id])
.map((unit) => {
let amiChart = amiChartMap[unit.amiChart.id];
if (unit.unitAmiChartOverrides) {
Expand Down
5 changes: 0 additions & 5 deletions api/test/unit/services/listing.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,6 @@ describe('Testing listing service', () => {
include: {
unitTypes: true,
unitAmiChartOverrides: true,
amiChart: true,
},
},
},
Expand Down Expand Up @@ -679,7 +678,6 @@ describe('Testing listing service', () => {
include: {
unitTypes: true,
unitAmiChartOverrides: true,
amiChart: true,
},
},
},
Expand Down Expand Up @@ -824,7 +822,6 @@ describe('Testing listing service', () => {
include: {
unitTypes: true,
unitAmiChartOverrides: true,
amiChart: true,
},
},
},
Expand Down Expand Up @@ -1122,7 +1119,6 @@ describe('Testing listing service', () => {
include: {
unitTypes: true,
unitAmiChartOverrides: true,
amiChart: true,
},
},
},
Expand Down Expand Up @@ -1516,7 +1512,6 @@ describe('Testing listing service', () => {
include: {
unitTypes: true,
unitAmiChartOverrides: true,
amiChart: true,
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions shared-helpers/src/auth/catchNetworkError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export type NetworkErrorDetermineError = (
export type NetworkErrorReset = () => void

export enum NetworkErrorMessage {
PasswordOutdated = "passwordOutdated",
PasswordOutdated = "but password is no longer valid",
MfaUnauthorized = "mfaUnauthorized",
}

Expand All @@ -38,7 +38,7 @@ export const useCatchNetworkError = () => {
const [networkError, setNetworkError] = useState<NetworkStatusContent>(null)

const check401Error = (message: string, error: AxiosError) => {
if (message === NetworkErrorMessage.PasswordOutdated) {
if (message.includes(NetworkErrorMessage.PasswordOutdated)) {
setNetworkError({
title: t("authentication.signIn.passwordOutdated"),
description: `${t(
Expand Down

0 comments on commit 61a6b7f

Please sign in to comment.