Function loadData
has 47 lines of code (exceeds 25 allowed). Consider refactoring.
async loadData () {
if (this.config.mockData === true) {
this.sendSocketNotification(this.notifications.DATA_RESPONSE, {
payloadReturn: this.mockData(),
status: 'OK',
Function authenticateRefresh
has 36 lines of code (exceeds 25 allowed). Consider refactoring.
async authenticateRefresh (refreshToken) {
console.log('Netatmo: Refresh Token')
const params = new URLSearchParams()
params.append('grant_type', 'refresh_token')
params.append('refresh_token', refreshToken)
Function authenticate
has 35 lines of code (exceeds 25 allowed). Consider refactoring.
async authenticate () {
const params = new URLSearchParams()
params.append('grant_type', 'refresh_token')
params.append('refresh_token', this.refreshToken)
params.append('client_id', this.clientId)
Similar blocks of code found in 2 locations. Consider refactoring.
if (result.expires_in) {
const expireAt = moment(Date.now() + (result.expires_in * 1000)).format('LLLL')
console.log(`Netatmo: New Token Expire ${expireAt}`)
setTimeout(() => this.authenticateRefresh(result.refresh_token), (result.expires_in - 60) * 1000)
};
Similar blocks of code found in 2 locations. Consider refactoring.
if (result.expires_in) {
const expireAt = moment(Date.now() + (result.expires_in * 1000)).format('LLLL')
console.log(`Netatmo: New Token Expire ${expireAt}`)
setTimeout(() => this.authenticateRefresh(result.refresh_token), (result.expires_in - 60) * 1000)
};
Identical blocks of code found in 2 locations. Consider refactoring.
const result = await fetch(`https://${this.config.apiBase}${this.config.authEndpoint}`, {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: params,
}).then((response) => response.json())
Identical blocks of code found in 2 locations. Consider refactoring.
const result = await fetch(`https://${this.config.apiBase}${this.config.authEndpoint}`, {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: params,
}).then((response) => response.json())
Similar blocks of code found in 2 locations. Consider refactoring.
try {
const result = await fetch(`https://${this.config.apiBase}${this.config.authEndpoint}`, {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: params,
Similar blocks of code found in 2 locations. Consider refactoring.
try {
let result = await fetch(`https://${this.config.apiBase}${this.config.dataEndpoint}`, {
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${this.token}`,
There are no issues that match your filters.