-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of https://github.com/prgrms-web-devcourse/Tea…
…m-12-ReviewRanger-FE into REV-399/활성화된-탭-페이지-이동-시에도-고정
- Loading branch information
Showing
7 changed files
with
142 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { useState, useEffect } from 'react' | ||
import { useLocation } from 'react-router-dom' | ||
|
||
const useCheckHeaderRoute = () => { | ||
const location = useLocation() | ||
const [logoButtonClicked, setLogoButtonClicked] = useState<boolean>(false) | ||
const [prevButtonClicked, setPrevButtonClicked] = useState<boolean>(false) | ||
const [myPageButtonClicked, setMyPageButtonClicked] = useState<boolean>(false) | ||
|
||
useEffect(() => { | ||
if ( | ||
location.pathname === '/review-creation' || | ||
location.pathname.includes('/review-response') | ||
) { | ||
setLogoButtonClicked(true) | ||
setPrevButtonClicked(true) | ||
setMyPageButtonClicked(true) | ||
} else { | ||
setLogoButtonClicked(false) | ||
setPrevButtonClicked(false) | ||
setMyPageButtonClicked(false) | ||
} | ||
|
||
return () => { | ||
setLogoButtonClicked(false) | ||
setMyPageButtonClicked(false) | ||
setPrevButtonClicked(false) | ||
} | ||
}, []) | ||
|
||
return { logoButtonClicked, prevButtonClicked, myPageButtonClicked } | ||
} | ||
|
||
export default useCheckHeaderRoute |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,37 @@ | ||
import path from 'path' | ||
import react from '@vitejs/plugin-react' | ||
import { defineConfig } from 'vite' | ||
import { defineConfig, loadEnv } from 'vite' | ||
import svgr from 'vite-plugin-svgr' | ||
|
||
export default defineConfig({ | ||
plugins: [react(), svgr()], | ||
resolve: { | ||
alias: [{ find: '@', replacement: path.resolve(__dirname, 'src') }], | ||
}, | ||
// 환경 변수 로드 | ||
export default ({ mode }) => { | ||
const env = { ...process.env, ...loadEnv(mode, process.cwd()) } | ||
|
||
build: { | ||
rollupOptions: { | ||
external: (id) => { | ||
if (id.includes('/node_modules/@mswjs')) { | ||
return true | ||
} | ||
if (id.includes('/src/mocks')) { | ||
return true | ||
} | ||
return defineConfig({ | ||
plugins: [react(), svgr()], | ||
resolve: { | ||
alias: [{ find: '@', replacement: path.resolve(__dirname, 'src') }], | ||
}, | ||
build: { | ||
rollupOptions: { | ||
external: (id) => { | ||
if (id.includes('/node_modules/@mswjs')) { | ||
return true | ||
} | ||
if (id.includes('/src/mocks')) { | ||
return true | ||
} | ||
}, | ||
}, | ||
}, | ||
server: { | ||
proxy: { | ||
'/api': { | ||
target: env.VITE_API_KEY, | ||
changeOrigin: true, | ||
rewrite: (path) => path.replace(/^\/api/, ''), | ||
}, | ||
}, | ||
}, | ||
}, | ||
}) | ||
}) | ||
} |