Compare commits
No commits in common. "f06b7cf0ac104ab0df0486c48c4499e866557a0d" and "663e60b9e6c463a7e3ba594047a998c2f1fb58e2" have entirely different histories.
f06b7cf0ac
...
663e60b9e6
@ -1,73 +1,33 @@
|
|||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { NextResponse } from 'next/server'
|
import { NextResponse } from 'next/server'
|
||||||
|
|
||||||
// export async function GET(request: Request) {
|
|
||||||
// const { searchParams } = new URL(request.url)
|
|
||||||
// const encodeFileNo = searchParams.get('encodeFileNo')
|
|
||||||
// const srcFileNm = searchParams.get('srcFileNm')
|
|
||||||
|
|
||||||
// if (!encodeFileNo) {
|
|
||||||
// return NextResponse.json({ error: 'encodeFileNo is required' }, { status: 400 })
|
|
||||||
// }
|
|
||||||
|
|
||||||
// try {
|
|
||||||
// const response = await axios.get(`${process.env.NEXT_PUBLIC_INQUIRY_API_URL}/api/file/downloadFile2`, {
|
|
||||||
// params: {
|
|
||||||
// encodeFileNo,
|
|
||||||
// },
|
|
||||||
// responseType: 'arraybuffer',
|
|
||||||
// })
|
|
||||||
|
|
||||||
// if (response.headers['content-type'] === 'text/html;charset=utf-8') {
|
|
||||||
// return NextResponse.json({ error: 'file not found' }, { status: 404 })
|
|
||||||
// }
|
|
||||||
|
|
||||||
// const contentType = response.headers['content-type'] || 'application/octet-stream'
|
|
||||||
// const contentDisposition = response.headers['content-disposition'] || 'inline'
|
|
||||||
|
|
||||||
// return new NextResponse(response.data, {
|
|
||||||
// status: 200,
|
|
||||||
// headers: {
|
|
||||||
// 'Content-Type': contentType,
|
|
||||||
// 'Content-Disposition': contentDisposition,
|
|
||||||
// },
|
|
||||||
// })
|
|
||||||
// } catch (error: any) {
|
|
||||||
// console.error('File download error:', error)
|
|
||||||
// return NextResponse.json({ error: error.response?.data || 'Failed to download file' }, { status: 500 })
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
export async function GET(request: Request) {
|
export async function GET(request: Request) {
|
||||||
const { searchParams } = new URL(request.url)
|
const { searchParams } = new URL(request.url)
|
||||||
const encodeFileNo = searchParams.get('encodeFileNo')
|
const encodeFileNo = searchParams.get('encodeFileNo')
|
||||||
const srcFileNm = searchParams.get('srcFileNm') || 'downloaded-file'
|
|
||||||
|
const srcFileNm = searchParams.get('srcFileNm')
|
||||||
|
|
||||||
if (!encodeFileNo) {
|
if (!encodeFileNo) {
|
||||||
return NextResponse.json({ error: 'encodeFileNo is required' }, { status: 400 })
|
return NextResponse.json({ error: 'encodeFileNo is required' }, { status: 400 })
|
||||||
}
|
}
|
||||||
|
|
||||||
const url = `${process.env.NEXT_PUBLIC_INQUIRY_API_URL}/api/file/downloadFile2?encodeFileNo=${encodeFileNo}`
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const resp = await fetch(url)
|
const response = await axios.get(`${process.env.NEXT_PUBLIC_INQUIRY_API_URL}/api/file/downloadFile2`, {
|
||||||
|
responseType: 'arraybuffer',
|
||||||
if (!resp.ok) {
|
params: {
|
||||||
return NextResponse.json({ error: 'Failed to download file' }, { status: 500 })
|
encodeFileNo,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
if (response.headers['content-type'] === 'text/html;charset=utf-8') {
|
||||||
|
return NextResponse.json({ error: 'file not found' }, { status: 404 })
|
||||||
}
|
}
|
||||||
|
return new NextResponse(response.data, {
|
||||||
const contentType = resp.headers.get('content-type') || 'application/octet-stream'
|
|
||||||
const contentDisposition = resp.headers.get('content-disposition') || `attachment; filename="${srcFileNm}"`
|
|
||||||
|
|
||||||
return new NextResponse(resp.body, {
|
|
||||||
status: 200,
|
status: 200,
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': contentType,
|
'Content-Type': 'application/octet-stream;charset=UTF-8',
|
||||||
'Content-Disposition': contentDisposition,
|
'Content-Disposition': `attachment; filename="${srcFileNm}"`,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
console.error('File download error:', error)
|
return NextResponse.json({ error: error.response.data }, { status: 500 })
|
||||||
return NextResponse.json({ error: error.response?.data || 'Failed to download file' }, { status: 500 })
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import { useState } from 'react'
|
|||||||
|
|
||||||
export default function ListForm() {
|
export default function ListForm() {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const { inquiryListRequest, setInquiryListRequest, reset, setOffset } = useInquiryFilterStore()
|
const { inquiryListRequest, setInquiryListRequest, reset } = useInquiryFilterStore()
|
||||||
const [searchKeyword, setSearchKeyword] = useState(inquiryListRequest.schTitle ?? '')
|
const [searchKeyword, setSearchKeyword] = useState(inquiryListRequest.schTitle ?? '')
|
||||||
|
|
||||||
const handleSearch = () => {
|
const handleSearch = () => {
|
||||||
@ -40,19 +40,6 @@ export default function ListForm() {
|
|||||||
onChange={(e) => setSearchKeyword(e.target.value)}
|
onChange={(e) => setSearchKeyword(e.target.value)}
|
||||||
onKeyDown={handleKeyDown}
|
onKeyDown={handleKeyDown}
|
||||||
/>
|
/>
|
||||||
{searchKeyword && (
|
|
||||||
<button
|
|
||||||
className="del-icon"
|
|
||||||
onClick={() => {
|
|
||||||
setSearchKeyword('')
|
|
||||||
setInquiryListRequest({
|
|
||||||
...inquiryListRequest,
|
|
||||||
schTitle: '',
|
|
||||||
})
|
|
||||||
setOffset(1)
|
|
||||||
}}
|
|
||||||
></button>
|
|
||||||
)}
|
|
||||||
<button className="search-icon" onClick={handleSearch}></button>
|
<button className="search-icon" onClick={handleSearch}></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -86,7 +86,7 @@ export default function ListTable() {
|
|||||||
<div className="inquiry-table-filter">
|
<div className="inquiry-table-filter">
|
||||||
<div className="filter-check">
|
<div className="filter-check">
|
||||||
<div className="check-form-box">
|
<div className="check-form-box">
|
||||||
<input type="checkbox" id="ch01" onChange={handleMyInquiry} checked={inquiryListRequest.schRegId === session.userId} />
|
<input type="checkbox" id="ch01" onChange={handleMyInquiry} />
|
||||||
<label htmlFor="ch01">私が書いたお問い合わせ</label>
|
<label htmlFor="ch01">私が書いたお問い合わせ</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,10 +1,21 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
|
import Link from 'next/link'
|
||||||
|
import Config from '@/config/config.export'
|
||||||
|
|
||||||
export default function Footer() {
|
export default function Footer() {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<footer>
|
<footer>
|
||||||
<div className="footer-inner">COPYRIGHT©2025 Hanwha Japan All Rights Reserved </div>
|
<div className="footer-inner">
|
||||||
|
COPYRIGHT©2025 Hanwha Japan All Rights Reserved{' '}
|
||||||
|
<span>
|
||||||
|
<Link href="/pdf/suitable">PDF</Link>
|
||||||
|
</span>
|
||||||
|
<span>{Config().mode}</span>
|
||||||
|
<span>{Config().baseUrl}</span>
|
||||||
|
<span>{process.env.NEXT_PUBLIC_API_URL}</span>
|
||||||
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -11,8 +11,6 @@ import { useSideNavState } from '@/store/sideNavState'
|
|||||||
import { useHeaderStore } from '@/store/header'
|
import { useHeaderStore } from '@/store/header'
|
||||||
import { useSessionStore } from '@/store/session'
|
import { useSessionStore } from '@/store/session'
|
||||||
import { usePopupController } from '@/store/popupController'
|
import { usePopupController } from '@/store/popupController'
|
||||||
import { useSurveyFilterStore } from '@/store/surveyFilterStore'
|
|
||||||
import { useInquiryFilterStore } from '@/store/inquiryFilterStore'
|
|
||||||
|
|
||||||
import { useTitle } from '@/hooks/useTitle'
|
import { useTitle } from '@/hooks/useTitle'
|
||||||
import { useAxios } from '@/hooks/useAxios'
|
import { useAxios } from '@/hooks/useAxios'
|
||||||
@ -32,9 +30,6 @@ export default function Header() {
|
|||||||
|
|
||||||
const popupController = usePopupController()
|
const popupController = usePopupController()
|
||||||
|
|
||||||
const { setIsMySurvey } = useSurveyFilterStore()
|
|
||||||
const { setInquiryListRequest, inquiryListRequest } = useInquiryFilterStore()
|
|
||||||
|
|
||||||
if (pathname === '/login') {
|
if (pathname === '/login') {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
@ -85,27 +80,13 @@ export default function Header() {
|
|||||||
<div className="side-swiper-wrap">
|
<div className="side-swiper-wrap">
|
||||||
<Swiper slidesPerView={1.6} spaceBetween={12} className="mySwiper">
|
<Swiper slidesPerView={1.6} spaceBetween={12} className="mySwiper">
|
||||||
<SwiperSlide>
|
<SwiperSlide>
|
||||||
<div
|
<div className="side-swiper-card">
|
||||||
className="side-swiper-card"
|
|
||||||
onClick={() => {
|
|
||||||
setIsMySurvey(session?.userId)
|
|
||||||
router.push('/survey-sale')
|
|
||||||
setSideNavIsOpen(false)
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div className="side-swiper-icon icon01"></div>
|
<div className="side-swiper-icon icon01"></div>
|
||||||
<div className="side-swiper-infor">私は作成した物件</div>
|
<div className="side-swiper-infor">私は作成した物件</div>
|
||||||
</div>
|
</div>
|
||||||
</SwiperSlide>
|
</SwiperSlide>
|
||||||
<SwiperSlide>
|
<SwiperSlide>
|
||||||
<div
|
<div className="side-swiper-card">
|
||||||
className="side-swiper-card"
|
|
||||||
onClick={() => {
|
|
||||||
setInquiryListRequest({ ...inquiryListRequest, schRegId: session?.userId })
|
|
||||||
router.push('/inquiry/list')
|
|
||||||
setSideNavIsOpen(false)
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div className="side-swiper-icon icon02"></div>
|
<div className="side-swiper-icon icon02"></div>
|
||||||
<div className="side-swiper-infor">私は作成したお問 い合わせ</div>
|
<div className="side-swiper-infor">私は作成したお問 い合わせ</div>
|
||||||
</div>
|
</div>
|
||||||
@ -124,7 +105,7 @@ export default function Header() {
|
|||||||
<button onClick={() => router.push('/survey-sale')}>調査物件一覧</button>
|
<button onClick={() => router.push('/survey-sale')}>調査物件一覧</button>
|
||||||
</li>
|
</li>
|
||||||
<li className="side-nav-item">
|
<li className="side-nav-item">
|
||||||
<button onClick={() => router.push('/survey-sale/regist')}>調査物件登録</button>
|
<button onClick={() => router.push('/survey-sale/basic-info')}>調査物件登録</button>
|
||||||
</li>
|
</li>
|
||||||
<li className="side-nav-item">
|
<li className="side-nav-item">
|
||||||
<button onClick={() => router.push('/inquiry/list')}>1:1お問い合わせ</button>
|
<button onClick={() => router.push('/inquiry/list')}>1:1お問い合わせ</button>
|
||||||
|
|||||||
@ -9,9 +9,7 @@ export function useAxios() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const responseHandler = (response: AxiosResponse) => {
|
const responseHandler = (response: AxiosResponse) => {
|
||||||
// if (response.headers['spinner-state'] === undefined) {
|
|
||||||
useSpinnerStore.getState().setIsShow(false)
|
useSpinnerStore.getState().setIsShow(false)
|
||||||
// }
|
|
||||||
response.data = transferResponse(response)
|
response.data = transferResponse(response)
|
||||||
return response
|
return response
|
||||||
}
|
}
|
||||||
|
|||||||
@ -76,22 +76,19 @@ export function useInquiry(
|
|||||||
|
|
||||||
const downloadFile = async (encodeFileNo: number, srcFileNm: string) => {
|
const downloadFile = async (encodeFileNo: number, srcFileNm: string) => {
|
||||||
try {
|
try {
|
||||||
const resp = await fetch(`/api/qna/file?encodeFileNo=${encodeFileNo}&srcFileNm=${srcFileNm}`)
|
const resp = await axiosInstance(null).get<Blob>(`/api/qna/file`, { params: { encodeFileNo, srcFileNm } })
|
||||||
|
const blob = new Blob([resp.data], { type: 'application/octet-stream;charset=UTF-8' })
|
||||||
const blob = await resp.blob()
|
|
||||||
const url = URL.createObjectURL(blob)
|
const url = URL.createObjectURL(blob)
|
||||||
const a = document.createElement('a')
|
const a = document.createElement('a')
|
||||||
a.href = url
|
a.href = url
|
||||||
a.download = srcFileNm
|
a.download = `${srcFileNm}`
|
||||||
document.body.appendChild(a)
|
|
||||||
a.click()
|
a.click()
|
||||||
document.body.removeChild(a)
|
|
||||||
URL.revokeObjectURL(url)
|
URL.revokeObjectURL(url)
|
||||||
|
|
||||||
return blob
|
return blob
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
console.error('File download error:', error)
|
if (error.response.status === 404) {
|
||||||
alert('ファイルのダウンロードに失敗しました')
|
alert('ファイルが見つかりません')
|
||||||
|
}
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -175,9 +175,10 @@ export function useSurvey(id?: number): {
|
|||||||
})
|
})
|
||||||
return resp.data.id ?? 0
|
return resp.data.id ?? 0
|
||||||
},
|
},
|
||||||
onSuccess: () => {
|
onSuccess: (data) => {
|
||||||
queryClient.invalidateQueries({ queryKey: ['survey', 'list'] })
|
queryClient.invalidateQueries({ queryKey: ['survey', 'list'] })
|
||||||
queryClient.invalidateQueries({ queryKey: ['survey', id] })
|
queryClient.invalidateQueries({ queryKey: ['survey', id] })
|
||||||
|
return data
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user