refactor: Add axios header variable
This commit is contained in:
parent
af3422b663
commit
ec07e1bc19
@ -42,6 +42,7 @@ import { SurfaceShapeModal } from '@/components/ui/SurfaceShape'
|
|||||||
import { changeAllGableRoof, drawDirectionStringToArrow } from '@/util/qpolygon-utils'
|
import { changeAllGableRoof, drawDirectionStringToArrow } from '@/util/qpolygon-utils'
|
||||||
import ThumbnailList from '@/components/ui/ThumbnailLIst'
|
import ThumbnailList from '@/components/ui/ThumbnailLIst'
|
||||||
import ObjectPlacement from '@/components/ui/ObjectPlacement'
|
import ObjectPlacement from '@/components/ui/ObjectPlacement'
|
||||||
|
import { globalLocaleStore } from '@/store/localeAtom'
|
||||||
|
|
||||||
export default function Roof2(props) {
|
export default function Roof2(props) {
|
||||||
const { name, userId, email, isLoggedIn } = props
|
const { name, userId, email, isLoggedIn } = props
|
||||||
@ -58,7 +59,9 @@ export default function Roof2(props) {
|
|||||||
setBackImg,
|
setBackImg,
|
||||||
} = useCanvas('canvas')
|
} = useCanvas('canvas')
|
||||||
|
|
||||||
const { get } = useAxios()
|
const globalLocaleState = useRecoilValue(globalLocaleStore)
|
||||||
|
|
||||||
|
const { get } = useAxios(globalLocaleState)
|
||||||
|
|
||||||
const canvasRef = useRef(null)
|
const canvasRef = useRef(null)
|
||||||
|
|
||||||
|
|||||||
@ -6,10 +6,15 @@ import CanvasLayout from '@/components/floor-plan/CanvasLayout'
|
|||||||
import '@/styles/contents.scss'
|
import '@/styles/contents.scss'
|
||||||
import OuterLineWall from '@/components/floor-plan/modal/outerlinesetting/OuterLineWall'
|
import OuterLineWall from '@/components/floor-plan/modal/outerlinesetting/OuterLineWall'
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
|
import { globalLocaleStore } from '@/store/localeAtom'
|
||||||
|
import { useRecoilValue } from 'recoil'
|
||||||
|
import { useAxios } from '@/hooks/useAxios'
|
||||||
|
|
||||||
export default function FloorPlan() {
|
export default function FloorPlan() {
|
||||||
const [showCanvasSettingModal, setShowCanvasSettingModal] = useState(false)
|
const [showCanvasSettingModal, setShowCanvasSettingModal] = useState(false)
|
||||||
const [showOutlineModal, setShowOutlineModal] = useState(false)
|
const [showOutlineModal, setShowOutlineModal] = useState(false)
|
||||||
|
const globalLocaleState = useRecoilValue(globalLocaleStore)
|
||||||
|
const { get } = useAxios(globalLocaleState)
|
||||||
|
|
||||||
const canvasSettingProps = {
|
const canvasSettingProps = {
|
||||||
setShowCanvasSettingModal,
|
setShowCanvasSettingModal,
|
||||||
|
|||||||
@ -5,7 +5,7 @@ const AxiosType = {
|
|||||||
EXTERNAL: 'External',
|
EXTERNAL: 'External',
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useAxios() {
|
export function useAxios(lang = '') {
|
||||||
const getInstances = (url) => {
|
const getInstances = (url) => {
|
||||||
let type = AxiosType.INTERNAL
|
let type = AxiosType.INTERNAL
|
||||||
url.startsWith('http') ? (type = AxiosType.EXTERNAL) : ''
|
url.startsWith('http') ? (type = AxiosType.EXTERNAL) : ''
|
||||||
@ -14,6 +14,7 @@ export function useAxios() {
|
|||||||
baseURL: type === AxiosType.INTERNAL ? process.env.NEXT_PUBLIC_API_SERVER_PATH : '',
|
baseURL: type === AxiosType.INTERNAL ? process.env.NEXT_PUBLIC_API_SERVER_PATH : '',
|
||||||
headers: {
|
headers: {
|
||||||
Accept: 'application/json',
|
Accept: 'application/json',
|
||||||
|
lang,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user