Skip to content

Commit 7375519

Browse files
committed
linting
1 parent 7d83c51 commit 7375519

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

pages/api/auth/[...nextauth].js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,10 @@ const refreshAccessToken = async (token) => {
6565
const url = `https://${process.env.NEXT_PUBLIC_PROVIDER_NAME}.scientist.com/oauth/token`
6666
const encodedString = Buffer.from(`${process.env.CLIENT_ID}:${process.env.CLIENT_SECRET}`).toString('base64')
6767
const params = new URLSearchParams({
68+
/* eslint-disable camelcase */
6869
grant_type: 'refresh_token',
6970
refresh_token: token.refreshToken,
71+
/* eslint-enable camelcase */
7072
})
7173

7274
const response = await axios.post(url, params, {

pages/requests/[uuid].js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import {
2222
statusBarBg,
2323
useMessages,
2424
useFiles,
25-
useAllPOs,
25+
getAllPOs,
2626
useAllSOWs,
2727
useOneRequest,
2828
} from '../../utils'
@@ -45,7 +45,7 @@ const Request = () => {
4545
const [isPOLoading, setIsPOLoading] = useState(false)
4646
useEffect(() => {
4747
const getPOsAsync = async () => {
48-
const response = await useAllPOs(request?.quotedWareID, uuid, request?.identifier, session?.accessToken)
48+
const response = await getAllPOs(request?.quotedWareID, uuid, request?.identifier, session?.accessToken)
4949
if (response.allPOs) {
5050
setAllPOs(response.allPOs)
5151
} else if (response.isPOError) {
@@ -55,7 +55,7 @@ const Request = () => {
5555
}
5656
}
5757
getPOsAsync()
58-
}, [allPOs, isPOError]);
58+
}, [allPOs, isPOError, request?.quotedWareID, uuid, request?.identifier, session?.accessToken])
5959

6060
console.log(allPOs)
6161
const isLoading = isLoadingRequest || isLoadingSOWs || isLoadingFiles || isLoadingMessages || isPOLoading

utils/api/requests.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,16 @@ export const useAllSOWs = (id, requestIdentifier, accessToken) => {
5555
}
5656
}
5757

58-
// TODO(summer-cook): eventually we can use the useSWRList hook here instead of mapping & calling the fetcher. This hook is actively being contributed to the swr repo, but the semantics of the work are still being debated. see https://github.com/vercel/swr/discussions/1988 for the RFC and https://github.com/vercel/swr/pull/2047 for the PR.
59-
export const useAllPOs = async (quotedWareId, uuid, requestIdentifier, accessToken) => {
58+
// The name of this function is getAllPOs vs. useAllPOs.
59+
// Since it is async, it is technically not a custom hook and according to linter should not start with use.
60+
export const getAllPOs = async (quotedWareId, uuid, requestIdentifier, accessToken) => {
6061
let allPOs
6162
let enhancedPOArray = []
6263
let arrayOfPOIds = []
63-
try {
64+
try { d
65+
// TODO(summer-cook): eventually we can use the useSWRList hook here instead of mapping & calling the fetcher.
66+
// This hook is actively being contributed to the swr repo, but the semantics of the work are still being debated.
67+
// See https://github.com/vercel/swr/discussions/1988 for the RFC and https://github.com/vercel/swr/pull/2047 for the PR.
6468
const allPOData = await fetcher(`quote_groups/${uuid}/quoted_wares/${quotedWareId}/purchase_orders.json`, accessToken)
6569
allPOData && allPOData.map((po) => {arrayOfPOIds.push(po.id)})
6670
arrayOfPOIds && await Promise.all(arrayOfPOIds.map(async (poId) => {

0 commit comments

Comments
 (0)