Skip to content

Commit

Permalink
fix: b2C Quote Attachments Receiving Token Mismatch Error
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianJiang2021 authored and libruce committed Feb 22, 2024
1 parent 7e805d5 commit 847a5ad
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion apps/storefront/src/pages/quote/components/FileUpload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ interface FileUploadProps {
onDelete?: (id: string) => void
limitUploadFn?: () => boolean
isEndLoadding?: boolean
requestType?: string
}

const AttachFile = styled(AttachFileIcon)(() => ({
Expand All @@ -115,6 +116,7 @@ function FileUpload(props: FileUploadProps, ref: Ref<unknown>) {
allowUpload = true,
onDelete = noop,
isEndLoadding = false,
requestType = 'quoteAttachedFile',
} = props

const theme = useTheme()
Expand Down Expand Up @@ -198,7 +200,7 @@ function FileUpload(props: FileUploadProps, ref: Ref<unknown>) {
message,
} = await uploadB2BFile({
file,
type: 'quoteAttachedFile',
type: requestType,
})
if (code === 200) {
onchange({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useB3Lang } from '@b3/lang'
import { Box, Card, CardContent } from '@mui/material'

import { B3CollapseContainer } from '@/components'
import { useRole } from '@/hooks'
import { GlobaledContext } from '@/shared/global'
import {
quoteDetailAttachFileCreate,
Expand Down Expand Up @@ -33,6 +34,8 @@ export default function QuoteAttachment(props: QuoteAttachmentProps) {
},
} = useContext(GlobaledContext)

const [roleText] = useRole()

const [fileList, setFileList] = useState<FileObjects[]>([])

const uploadRef = useRef<UpLoaddingProps | null>(null)
Expand Down Expand Up @@ -153,6 +156,11 @@ export default function QuoteAttachment(props: QuoteAttachmentProps) {
<Box>
<FileUpload
ref={uploadRef}
requestType={
roleText !== 'b2b'
? 'customerQuoteAttachedFile'
: 'quoteAttachedFile'
}
isEndLoadding
fileList={fileList}
limitUploadFn={limitUploadFn}
Expand Down

0 comments on commit 847a5ad

Please sign in to comment.