Skip to content

Commit 214fb84

Browse files
committed
great fix
1 parent 8fdbaa8 commit 214fb84

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/App.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function request(target, data) {
3939
///////////////////////////////////
4040
function requestUser() {
4141
return request('ip', null).then(prom => {
42-
user = String(prom)
42+
user = String(prom) || "default"
4343
console.log("user ", user)
4444
})
4545
}
@@ -86,7 +86,7 @@ function loadData() {
8686
.then((d) => {
8787
let data = tryParce(d)//here we parce json
8888
console.log("[DATA] from loadData(): ", data)
89-
res(data)
89+
res(data || [])
9090
})
9191
.catch(rej)
9292
})
@@ -96,7 +96,7 @@ function postData(postData) {
9696
? loadData(null)
9797
: Promise.resolve(null))
9898
.then((data) => {
99-
let pDat = postData == null ? postData.concat(data) : postData
99+
let pDat = postData === null ? (data || []) : postData
100100
requestPostData(pDat)
101101
})
102102
}
@@ -123,7 +123,7 @@ function App() {
123123
React.useEffect(loadDataToServer, [cardsArr])
124124

125125
function loadDataToServer() {
126-
//console.log("***\n[HOOK] - loadDataToServer (onCardsArr)\n***")
126+
console.log("***\n[HOOK] - loadDataToServer (onCardsArr)\n***")
127127
postData(cardsArr)
128128
}
129129

0 commit comments

Comments
 (0)