fix: lint

This commit is contained in:
Ivan Shmidt
2020-05-18 18:44:19 +02:00
parent 3d01940191
commit e78eaa9bb6
3 changed files with 16 additions and 13 deletions
@@ -15,10 +15,10 @@
*/
import { errorApiRef, useApi } from '@backstage/core';
import { useCallback } from 'react';
import { circleCIApiRef, GitType } from '../api/index';
import { useSettings } from './useSettings';
import { useAsyncPolling } from './useAsyncPolling';
import { useAsyncRetry } from 'react-use';
import { circleCIApiRef, GitType } from '../api/index';
import { useAsyncPolling } from './useAsyncPolling';
import { useSettings } from './useSettings';
const INTERVAL_AMOUNT = 1500;
export function useBuildWithSteps(buildId: number) {
@@ -28,8 +28,9 @@ export function useBuildWithSteps(buildId: number) {
const getBuildWithSteps = useCallback(async () => {
if (owner === '' || repo === '' || token === '') {
return;
return Promise.reject('No credentials provided');
}
try {
const options = {
token: token,
@@ -39,8 +40,8 @@ export function useBuildWithSteps(buildId: number) {
type: GitType.GITHUB,
},
};
const b = await api.getBuild(buildId, options);
return Promise.resolve(b);
const build = await api.getBuild(buildId, options);
return Promise.resolve(build);
} catch (e) {
errorApi.post(e);
return Promise.reject(e);
@@ -14,10 +14,10 @@
* limitations under the License.
*/
import { errorApiRef, useApi } from '@backstage/core';
import { GitType, BuildSummary } from 'circleci-api';
import { useState, useEffect, useCallback } from 'react';
import { circleCIApiRef } from '../api/index';
import { BuildSummary, GitType } from 'circleci-api';
import { useCallback, useEffect, useState } from 'react';
import { useAsyncRetry } from 'react-use';
import { circleCIApiRef } from '../api/index';
import { CITableBuildInfo } from '../pages/BuildsPage/lib/CITable';
import { useSettings } from './useSettings';
@@ -80,9 +80,10 @@ export function useBuilds() {
const getBuilds = useCallback(
async ({ limit, offset }: { limit: number; offset: number }) => {
if (owner === '' || repo === '') {
return;
if (owner === '' || repo === '' || token === '') {
return Promise.reject('No credentials provided');
}
try {
return await api.getBuilds(
{ limit, offset },
+3 -2
View File
@@ -13,10 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { errorApiRef, useApi } from '@backstage/core';
import { useContext, useEffect } from 'react';
import { AppContext, STORAGE_KEY } from '.';
import { useApi, errorApiRef } from '@backstage/core';
import { AppContext, STORAGE_KEY } from './AppState';
import { Settings } from './types';
export function useSettings() {
const [settings, dispatch] = useContext(AppContext);