Skip to content

Commit f829820

Browse files
committed
fix: 현재 주소 null값 오류
- null이면 빈문자열 전달
1 parent 3b7d57c commit f829820

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/components/views/MainPage/MainPage.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ function MainPage(props) {
3030
const [address, setAddress] = useState(localStorage.getItem("currentDong"));
3131

3232
useEffect(() => {
33+
if (address == null) {
34+
setAddress("");
35+
}
3336
if (address != null) {
3437
axios.post(`http://localhost:8080/save/current/address/${islogedId}`, {address})
3538
.then((response) => {
@@ -68,6 +71,9 @@ function MainPage(props) {
6871
};
6972

7073
useEffect(() => {
74+
if (address == null) {
75+
setAddress("");
76+
}
7177
fetchPost();
7278
}, [history.action]);
7379

src/components/views/WritePage/WritePage.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ export default function WritePage(props) {
1919
// 주소 인증
2020
const [currentAddr, setCurrentAddr] = useState(localStorage.getItem("currentDong"));
2121
useEffect(() => {
22+
if (currentAddr == null) {
23+
setCurrentAddr("");
24+
}
2225
axios.get(`http://localhost:8080/address/certification/${islogedId}/${currentAddr}`)
2326
.then((response) => {
2427
console.log(response.data)

0 commit comments

Comments
 (0)