Skip to content

Commit 3c729c4

Browse files
committed
2 parents c22538f + ff5d226 commit 3c729c4

2 files changed

Lines changed: 20 additions & 5 deletions

File tree

src/index.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,16 @@ class Client {
159159
try {
160160
const res = await axios.get(url)
161161
const data = res.data
162-
for (const item of data) {
163-
await this.fetchConfigFromDbByNamespace(item.namespaceName)
164-
this.notifications[item.namespaceName] = item.notificationId
162+
if (data) {
163+
for (const item of data) {
164+
await this.fetchConfigFromDbByNamespace(item.namespaceName)
165+
this.notifications[item.namespaceName] = item.notificationId
166+
}
165167
}
166168
} catch (error) {
169+
if (+get(error, 'response.status') === 304) {
170+
return
171+
}
167172
this.error('pollingNotification error: ', error.message)
168173
}
169174
}

src/utils.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1-
const axios = require('axios');
1+
const axios = require('axios')
22

3-
exports.axios = axios.default;
3+
// axios.interceptors.response.use(function (response) {
4+
// return response
5+
// }, function (error) {
6+
// // console.log('error1111111111111111111111111', error)
7+
// // if (error.response && +error.response.status === 304) {
8+
// // return Promise.reject(new Error('304'))
9+
// // }
10+
// return Promise.reject(error)
11+
// })
12+
13+
exports.axios = axios.default

0 commit comments

Comments
 (0)