Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

337 api changes #338

Merged
merged 1 commit into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pages/requests/[uuid].js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const Request = ({ session }) => {
if (session === null) return unauthorizedUser

const isLoading = isLoadingRequest || isLoadingSOWs || isLoadingFiles || isLoadingMessages
const isError = isRequestError || isSOWError || isFilesError|| isMessagesError || isPOError
const isError = isRequestError || isSOWError || isFilesError || isMessagesError || isPOError
const documents = (allSOWs) ? [...allSOWs, ...allPOs] : []

if (isLoading) return pageLoading
Expand Down
4 changes: 2 additions & 2 deletions utils/api/configurations.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export const configureMessages = (data) => {
}))
}

export const configureFiles = (data) => {
export const configureFiles = (data) => {
// filter out the notes that do not have attachments
const notesWithFiles = data.filter(d => d.attachments?.length)
let fileArrays = []
Expand Down Expand Up @@ -235,7 +235,7 @@ export const configurePO = (po, requestIdentifier) => ({
...configureDocument(po, requestIdentifier),
turnaroundTime: po.turn_around_time.human,
poNumber: po.po_number,
relatedSOWIdentifier: po.proposal_ref?.identifier,
relatedSOWIdentifier: po.proposal_refs.first?.identifier,
adPO: po.scientist_identifier,
})

Expand Down
4 changes: 2 additions & 2 deletions utils/api/requests.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ export const getAllPOs = async (quotedWareId, uuid, requestIdentifier, accessTok
const url = () => accessToken ? `quote_groups/${uuid}/quoted_wares/${quotedWareId}/purchase_orders.json` : null
const data = await fetcher(url(), accessToken)
const configuredPOs = data?.purchase_orders.map(async (po) => {
const purchaseOrder = await fetcher(`quote_groups/${uuid}/quoted_wares/${quotedWareId}/purchase_orders/${po.id}.json`, accessToken)
return configurePO(purchaseOrder, requestIdentifier)
const res = await fetcher(`quote_groups/${uuid}/quoted_wares/${quotedWareId}/purchase_orders/${po.id}.json`, accessToken)
return configurePO(res.purchase_order, requestIdentifier)
})
const allPOs = await Promise.all(configuredPOs).then(res => res)

Expand Down
Loading