diff options
Diffstat (limited to 'src/stores')
-rw-r--r-- | src/stores/ServicesStore.ts | 17 | ||||
-rw-r--r-- | src/stores/lib/CachedRequest.ts | 6 | ||||
-rw-r--r-- | src/stores/lib/Request.ts | 1 |
3 files changed, 11 insertions, 13 deletions
diff --git a/src/stores/ServicesStore.ts b/src/stores/ServicesStore.ts index 7f4693cad..82f3b95ce 100644 --- a/src/stores/ServicesStore.ts +++ b/src/stores/ServicesStore.ts | |||
@@ -594,7 +594,7 @@ export default class ServicesStore extends TypedStore { | |||
594 | this.stores.router.push(redirect); | 594 | this.stores.router.push(redirect); |
595 | } | 595 | } |
596 | 596 | ||
597 | this.allServicesRequest.patch(result => { | 597 | this.allServicesRequest.patch((result: Service[]) => { |
598 | remove(result, (c: Service) => c.id === serviceId); | 598 | remove(result, (c: Service) => c.id === serviceId); |
599 | }); | 599 | }); |
600 | 600 | ||
@@ -606,7 +606,7 @@ export default class ServicesStore extends TypedStore { | |||
606 | // Get directory for recipe | 606 | // Get directory for recipe |
607 | const normalDirectory = getRecipeDirectory(recipe); | 607 | const normalDirectory = getRecipeDirectory(recipe); |
608 | const devDirectory = getDevRecipeDirectory(recipe); | 608 | const devDirectory = getDevRecipeDirectory(recipe); |
609 | let directory; | 609 | let directory: string; |
610 | 610 | ||
611 | if (pathExistsSync(normalDirectory)) { | 611 | if (pathExistsSync(normalDirectory)) { |
612 | directory = normalDirectory; | 612 | directory = normalDirectory; |
@@ -1028,7 +1028,7 @@ export default class ServicesStore extends TypedStore { | |||
1028 | } | 1028 | } |
1029 | 1029 | ||
1030 | this.reorderServicesRequest.execute(services); | 1030 | this.reorderServicesRequest.execute(services); |
1031 | this.allServicesRequest.patch(data => { | 1031 | this.allServicesRequest.patch((data: Service[]) => { |
1032 | for (const s of data) { | 1032 | for (const s of data) { |
1033 | s.order = services[s.id]; | 1033 | s.order = services[s.id]; |
1034 | } | 1034 | } |
@@ -1172,7 +1172,7 @@ export default class ServicesStore extends TypedStore { | |||
1172 | ); | 1172 | ); |
1173 | 1173 | ||
1174 | // eslint-disable-next-line unicorn/consistent-function-scoping | 1174 | // eslint-disable-next-line unicorn/consistent-function-scoping |
1175 | const resetTimer = service => { | 1175 | const resetTimer = (service: Service) => { |
1176 | service.lastPollAnswer = Date.now(); | 1176 | service.lastPollAnswer = Date.now(); |
1177 | service.lastPoll = Date.now(); | 1177 | service.lastPoll = Date.now(); |
1178 | }; | 1178 | }; |
@@ -1306,7 +1306,7 @@ export default class ServicesStore extends TypedStore { | |||
1306 | }); | 1306 | }); |
1307 | } | 1307 | } |
1308 | 1308 | ||
1309 | _cleanUpTeamIdAndCustomUrl(recipeId, data): any { | 1309 | _cleanUpTeamIdAndCustomUrl(recipeId: string, data: Service): any { |
1310 | const serviceData = data; | 1310 | const serviceData = data; |
1311 | const recipe = this.stores.recipes.one(recipeId); | 1311 | const recipe = this.stores.recipes.one(recipeId); |
1312 | 1312 | ||
@@ -1318,6 +1318,7 @@ export default class ServicesStore extends TypedStore { | |||
1318 | data.team && | 1318 | data.team && |
1319 | data.customUrl | 1319 | data.customUrl |
1320 | ) { | 1320 | ) { |
1321 | // @ts-expect-error The operand of a 'delete' operator must be optional. | ||
1321 | delete serviceData.team; | 1322 | delete serviceData.team; |
1322 | } | 1323 | } |
1323 | 1324 | ||
@@ -1343,7 +1344,7 @@ export default class ServicesStore extends TypedStore { | |||
1343 | } | 1344 | } |
1344 | 1345 | ||
1345 | // Helper | 1346 | // Helper |
1346 | _initializeServiceRecipeInWebview(serviceId) { | 1347 | _initializeServiceRecipeInWebview(serviceId: string) { |
1347 | const service = this.one(serviceId); | 1348 | const service = this.one(serviceId); |
1348 | 1349 | ||
1349 | if (service.webview) { | 1350 | if (service.webview) { |
@@ -1362,7 +1363,7 @@ export default class ServicesStore extends TypedStore { | |||
1362 | } | 1363 | } |
1363 | } | 1364 | } |
1364 | 1365 | ||
1365 | _initRecipePolling(serviceId) { | 1366 | _initRecipePolling(serviceId: string) { |
1366 | const service = this.one(serviceId); | 1367 | const service = this.one(serviceId); |
1367 | 1368 | ||
1368 | const delay = ms('2s'); | 1369 | const delay = ms('2s'); |
@@ -1385,7 +1386,7 @@ export default class ServicesStore extends TypedStore { | |||
1385 | } | 1386 | } |
1386 | } | 1387 | } |
1387 | 1388 | ||
1388 | _wrapIndex(index, delta, size) { | 1389 | _wrapIndex(index: number, delta: number, size: number) { |
1389 | return (((index + delta) % size) + size) % size; | 1390 | return (((index + delta) % size) + size) % size; |
1390 | } | 1391 | } |
1391 | } | 1392 | } |
diff --git a/src/stores/lib/CachedRequest.ts b/src/stores/lib/CachedRequest.ts index 25cc365e2..b24336fe6 100644 --- a/src/stores/lib/CachedRequest.ts +++ b/src/stores/lib/CachedRequest.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { action } from 'mobx'; | 1 | import { action } from 'mobx'; |
2 | import { isEqual, remove } from 'lodash'; | 2 | import { isEqual } from 'lodash'; |
3 | import Request from './Request'; | 3 | import Request from './Request'; |
4 | 4 | ||
5 | export default class CachedRequest extends Request { | 5 | export default class CachedRequest extends Request { |
@@ -110,10 +110,6 @@ export default class CachedRequest extends Request { | |||
110 | }); | 110 | }); |
111 | } | 111 | } |
112 | 112 | ||
113 | removeCacheForCallWith(...args: any): void { | ||
114 | remove(this._apiCalls, c => isEqual(c.args, args)); | ||
115 | } | ||
116 | |||
117 | _addApiCall(args: any) { | 113 | _addApiCall(args: any) { |
118 | const newCall = { args, result: null }; | 114 | const newCall = { args, result: null }; |
119 | this._apiCalls.push(newCall); | 115 | this._apiCalls.push(newCall); |
diff --git a/src/stores/lib/Request.ts b/src/stores/lib/Request.ts index f9424ac99..911c5ccfb 100644 --- a/src/stores/lib/Request.ts +++ b/src/stores/lib/Request.ts | |||
@@ -1,6 +1,7 @@ | |||
1 | import { observable, action, computed, makeObservable } from 'mobx'; | 1 | import { observable, action, computed, makeObservable } from 'mobx'; |
2 | import { isEqual } from 'lodash/fp'; | 2 | import { isEqual } from 'lodash/fp'; |
3 | 3 | ||
4 | // eslint-disable-next-line no-use-before-define | ||
4 | type Hook = (request: Request) => void; | 5 | type Hook = (request: Request) => void; |
5 | 6 | ||
6 | export default class Request { | 7 | export default class Request { |