From 7242c1b15552c9c21b70fda9e8a9c190375d1310 Mon Sep 17 00:00:00 2001 From: Nikita Nek Dudnik Date: Fri, 8 May 2020 15:10:15 +0200 Subject: [PATCH] Fix linting --- plugins/circleci/src/App.tsx | 15 +++++++++ .../circleci/src/components/Layout/Layout.tsx | 15 +++++++++ .../circleci/src/components/Layout/index.ts | 15 +++++++++ .../components/PluginHeader/PluginHeader.tsx | 15 +++++++++ .../src/components/PluginHeader/index.ts | 15 +++++++++ .../src/pages/BuildsPage/BuildsPage.tsx | 15 +++++++++ .../circleci/src/pages/BuildsPage/index.ts | 15 +++++++++ .../pages/BuildsPage/lib/Builds/Builds.tsx | 15 +++++++++ .../src/pages/BuildsPage/lib/Builds/index.ts | 15 +++++++++ .../pages/BuildsPage/lib/CITable/CITable.tsx | 17 +++++++++- .../src/pages/BuildsPage/lib/CITable/index.ts | 15 +++++++++ .../DetailedViewPage/DetailedViewPage.tsx | 17 +++++++++- .../src/pages/DetailedViewPage/index.ts | 15 +++++++++ .../lib/ActionOutput/ActionOutput.tsx | 15 +++++++++ .../lib/ActionOutput/index.ts | 15 +++++++++ .../src/pages/SettingsPage/SettingsPage.tsx | 17 +++++++++- .../circleci/src/pages/SettingsPage/index.ts | 15 +++++++++ plugins/circleci/src/proxy.ts | 15 +++++++++ .../src/state/models/buildWithSteps.ts | 21 +++++++++++++ plugins/circleci/src/state/models/builds.ts | 31 +++++++++++++++++-- plugins/circleci/src/state/models/index.ts | 15 +++++++++ plugins/circleci/src/state/models/settings.ts | 21 ++++++++++++- plugins/circleci/src/state/store.ts | 15 +++++++++ 23 files changed, 373 insertions(+), 6 deletions(-) diff --git a/plugins/circleci/src/App.tsx b/plugins/circleci/src/App.tsx index 111989405f..eddb9556ad 100644 --- a/plugins/circleci/src/App.tsx +++ b/plugins/circleci/src/App.tsx @@ -1,3 +1,18 @@ +/* + * Copyright 2020 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import React from 'react'; import { Route, Switch } from 'react-router'; import { Provider, useDispatch } from 'react-redux'; diff --git a/plugins/circleci/src/components/Layout/Layout.tsx b/plugins/circleci/src/components/Layout/Layout.tsx index 4ddf4b7c90..880e3f82a8 100644 --- a/plugins/circleci/src/components/Layout/Layout.tsx +++ b/plugins/circleci/src/components/Layout/Layout.tsx @@ -1,3 +1,18 @@ +/* + * Copyright 2020 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import React from 'react'; import { Header, Page, pageTheme, HeaderLabel } from '@backstage/core'; // @ts-ignore diff --git a/plugins/circleci/src/components/Layout/index.ts b/plugins/circleci/src/components/Layout/index.ts index 9877e7f4ae..236fc98851 100644 --- a/plugins/circleci/src/components/Layout/index.ts +++ b/plugins/circleci/src/components/Layout/index.ts @@ -1 +1,16 @@ +/* + * Copyright 2020 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ export * from './Layout'; diff --git a/plugins/circleci/src/components/PluginHeader/PluginHeader.tsx b/plugins/circleci/src/components/PluginHeader/PluginHeader.tsx index 9676f86e42..b65683f4f8 100644 --- a/plugins/circleci/src/components/PluginHeader/PluginHeader.tsx +++ b/plugins/circleci/src/components/PluginHeader/PluginHeader.tsx @@ -1,3 +1,18 @@ +/* + * Copyright 2020 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import React, { FC } from 'react'; import { Link as RouterLink, useLocation } from 'react-router-dom'; import { ContentHeader, SupportButton } from '@backstage/core'; diff --git a/plugins/circleci/src/components/PluginHeader/index.ts b/plugins/circleci/src/components/PluginHeader/index.ts index e9231f1318..4de972f6f2 100644 --- a/plugins/circleci/src/components/PluginHeader/index.ts +++ b/plugins/circleci/src/components/PluginHeader/index.ts @@ -1 +1,16 @@ +/* + * Copyright 2020 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ export * from './PluginHeader'; diff --git a/plugins/circleci/src/pages/BuildsPage/BuildsPage.tsx b/plugins/circleci/src/pages/BuildsPage/BuildsPage.tsx index 6c1c3f0638..70722ae487 100644 --- a/plugins/circleci/src/pages/BuildsPage/BuildsPage.tsx +++ b/plugins/circleci/src/pages/BuildsPage/BuildsPage.tsx @@ -1,3 +1,18 @@ +/* + * Copyright 2020 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import React, { FC } from 'react'; import { Content } from '@backstage/core'; import { Grid } from '@material-ui/core'; diff --git a/plugins/circleci/src/pages/BuildsPage/index.ts b/plugins/circleci/src/pages/BuildsPage/index.ts index 94086cd569..bb9de5d696 100644 --- a/plugins/circleci/src/pages/BuildsPage/index.ts +++ b/plugins/circleci/src/pages/BuildsPage/index.ts @@ -1 +1,16 @@ +/* + * Copyright 2020 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ export * from './BuildsPage'; diff --git a/plugins/circleci/src/pages/BuildsPage/lib/Builds/Builds.tsx b/plugins/circleci/src/pages/BuildsPage/lib/Builds/Builds.tsx index ebf4e37300..97227d5342 100644 --- a/plugins/circleci/src/pages/BuildsPage/lib/Builds/Builds.tsx +++ b/plugins/circleci/src/pages/BuildsPage/lib/Builds/Builds.tsx @@ -1,3 +1,18 @@ +/* + * Copyright 2020 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ /* * Copyright 2020 Spotify AB * diff --git a/plugins/circleci/src/pages/BuildsPage/lib/Builds/index.ts b/plugins/circleci/src/pages/BuildsPage/lib/Builds/index.ts index c2649d7919..e91a9496b7 100644 --- a/plugins/circleci/src/pages/BuildsPage/lib/Builds/index.ts +++ b/plugins/circleci/src/pages/BuildsPage/lib/Builds/index.ts @@ -1 +1,16 @@ +/* + * Copyright 2020 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ export { Builds } from './Builds'; diff --git a/plugins/circleci/src/pages/BuildsPage/lib/CITable/CITable.tsx b/plugins/circleci/src/pages/BuildsPage/lib/CITable/CITable.tsx index cf4fd74b81..8be304e873 100644 --- a/plugins/circleci/src/pages/BuildsPage/lib/CITable/CITable.tsx +++ b/plugins/circleci/src/pages/BuildsPage/lib/CITable/CITable.tsx @@ -1,3 +1,18 @@ +/* + * Copyright 2020 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import React, { FC } from 'react'; import { Link, Typography, Box, IconButton } from '@material-ui/core'; import { Replay as RetryIcon, GitHub as GithubIcon } from '@material-ui/icons'; @@ -29,7 +44,7 @@ export type CITableBuildInfo = { passed: number; skipped: number; failed: number; - testUrl: string; //fixme better name + testUrl: string; // fixme better name }; onRetryClick: () => void; }; diff --git a/plugins/circleci/src/pages/BuildsPage/lib/CITable/index.ts b/plugins/circleci/src/pages/BuildsPage/lib/CITable/index.ts index 279634bce6..600d6d689f 100644 --- a/plugins/circleci/src/pages/BuildsPage/lib/CITable/index.ts +++ b/plugins/circleci/src/pages/BuildsPage/lib/CITable/index.ts @@ -1 +1,16 @@ +/* + * Copyright 2020 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ export { CITable, CITableBuildInfo } from './CITable'; diff --git a/plugins/circleci/src/pages/DetailedViewPage/DetailedViewPage.tsx b/plugins/circleci/src/pages/DetailedViewPage/DetailedViewPage.tsx index 297936b765..0a0c90c649 100644 --- a/plugins/circleci/src/pages/DetailedViewPage/DetailedViewPage.tsx +++ b/plugins/circleci/src/pages/DetailedViewPage/DetailedViewPage.tsx @@ -1,3 +1,18 @@ +/* + * Copyright 2020 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import React, { FC } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import { useParams } from 'react-router-dom'; @@ -72,7 +87,7 @@ const pickClassName = ( return classes.neutral; }; export const DetailedViewPage: FC<{}> = () => { - let { buildId = '' } = useParams(); + const { buildId = '' } = useParams(); const classes = useStyles(); const dispatch: Dispatch = useDispatch(); const api = useApi(circleCIApiRef); diff --git a/plugins/circleci/src/pages/DetailedViewPage/index.ts b/plugins/circleci/src/pages/DetailedViewPage/index.ts index 578eec4e64..62bbabbfe5 100644 --- a/plugins/circleci/src/pages/DetailedViewPage/index.ts +++ b/plugins/circleci/src/pages/DetailedViewPage/index.ts @@ -1 +1,16 @@ +/* + * Copyright 2020 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ export * from './DetailedViewPage'; diff --git a/plugins/circleci/src/pages/DetailedViewPage/lib/ActionOutput/ActionOutput.tsx b/plugins/circleci/src/pages/DetailedViewPage/lib/ActionOutput/ActionOutput.tsx index 03bf984835..f502c7bede 100644 --- a/plugins/circleci/src/pages/DetailedViewPage/lib/ActionOutput/ActionOutput.tsx +++ b/plugins/circleci/src/pages/DetailedViewPage/lib/ActionOutput/ActionOutput.tsx @@ -1,3 +1,18 @@ +/* + * Copyright 2020 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import React, { useEffect, useState, FC, Suspense } from 'react'; import { ExpansionPanel, diff --git a/plugins/circleci/src/pages/DetailedViewPage/lib/ActionOutput/index.ts b/plugins/circleci/src/pages/DetailedViewPage/lib/ActionOutput/index.ts index 1e4fd5dfac..7cf74c73f8 100644 --- a/plugins/circleci/src/pages/DetailedViewPage/lib/ActionOutput/index.ts +++ b/plugins/circleci/src/pages/DetailedViewPage/lib/ActionOutput/index.ts @@ -1 +1,16 @@ +/* + * Copyright 2020 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ export { ActionOutput } from './ActionOutput'; diff --git a/plugins/circleci/src/pages/SettingsPage/SettingsPage.tsx b/plugins/circleci/src/pages/SettingsPage/SettingsPage.tsx index 155669737a..4f2e3d0239 100644 --- a/plugins/circleci/src/pages/SettingsPage/SettingsPage.tsx +++ b/plugins/circleci/src/pages/SettingsPage/SettingsPage.tsx @@ -1,3 +1,18 @@ +/* + * Copyright 2020 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import React, { useState } from 'react'; import { useSelector, useDispatch } from 'react-redux'; import { @@ -60,7 +75,7 @@ export const SettingsPage = () => { title={ <> Project Credentials - {/*{authed ? : } */} + {/* {authed ? : } */} ; pollingIntervalId: number | null; pollingState: PollingState; + getBuildError: Error | null; }; const INTERVAL_AMOUNT = 1500; @@ -19,6 +35,7 @@ export const buildWithSteps = { builds: {}, pollingIntervalId: null, pollingState: PollingState.Idle, + getBuildError: null, } as BuildState, reducers: { setBuild(state: BuildState, payload: BuildWithSteps) { @@ -30,6 +47,9 @@ export const buildWithSteps = { builds: { ...state.builds, [payload.build_num!]: payload }, }; }, + setBuildError(state: BuildState, payload: Error | null) { + return { ...state, getBuildError: payload }; + }, setPollingIntervalId(state: BuildState, payload: number | null) { return { ...state, @@ -45,6 +65,7 @@ export const buildWithSteps = { state: iRootState, ) { try { + d; //ispatch.buildWithSteps.() const options = { token: state.settings.token, vcs: { diff --git a/plugins/circleci/src/state/models/builds.ts b/plugins/circleci/src/state/models/builds.ts index 8d5f9727d6..57481b1d6f 100644 --- a/plugins/circleci/src/state/models/builds.ts +++ b/plugins/circleci/src/state/models/builds.ts @@ -1,3 +1,18 @@ +/* + * Copyright 2020 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import { Dispatch, iRootState } from '../store'; import { BuildSummary, GitType } from 'circleci-api'; import { CircleCIApi } from '../../api'; @@ -6,6 +21,8 @@ export type BuildsState = { builds: BuildSummary[]; pollingIntervalId: number | null; pollingState: PollingState; + restartBuildError: Error | null; + getBuildsError: Error | null; }; const INTERVAL_AMOUNT = 1500; @@ -19,6 +36,8 @@ export const builds = { builds: [] as BuildSummary[], pollingIntervalId: null, pollingState: PollingState.Idle, + restartBuildError: null, + getBuildsError: null, }, reducers: { setBuilds(state: BuildsState, payload: BuildSummary[]) { @@ -35,10 +54,17 @@ export const builds = { payload === null ? PollingState.Idle : PollingState.Polling, }; }, + setRestartBuildError(state: BuildsState, payload: Error | null) { + return { ...state, restartBuildError: payload }; + }, + setGetBuildsError(state: BuildsState, payload: Error | null) { + return { ...state, getBuildsError: payload }; + }, }, effects: (dispatch: Dispatch) => ({ async getBuilds(api: CircleCIApi, state: iRootState) { try { + dispatch.builds.setGetBuildsError(null); const builds = await api.getBuilds({ token: state.settings.token, vcs: { @@ -49,7 +75,7 @@ export const builds = { }); dispatch.builds.setBuilds(builds); } catch (e) { - console.log(e); + dispatch.builds.setGetBuildsError(null); } }, async restartBuild( @@ -57,6 +83,7 @@ export const builds = { state: iRootState, ) { try { + dispatch.builds.setRestartBuildError(null); await api.retry(buildId, { token: state.settings.token, vcs: { @@ -66,7 +93,7 @@ export const builds = { }, }); } catch (e) { - console.log(e); + dispatch.builds.setRestartBuildError(e); } }, diff --git a/plugins/circleci/src/state/models/index.ts b/plugins/circleci/src/state/models/index.ts index ff1396d97d..44c87dcc3b 100644 --- a/plugins/circleci/src/state/models/index.ts +++ b/plugins/circleci/src/state/models/index.ts @@ -1,3 +1,18 @@ +/* + * Copyright 2020 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import { settings } from './settings'; import { builds } from './builds'; import { buildWithSteps } from './buildWithSteps'; diff --git a/plugins/circleci/src/state/models/settings.ts b/plugins/circleci/src/state/models/settings.ts index dda4f86cfa..49b261852a 100644 --- a/plugins/circleci/src/state/models/settings.ts +++ b/plugins/circleci/src/state/models/settings.ts @@ -1,3 +1,18 @@ +/* + * Copyright 2020 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import { Dispatch, iRootState } from '../store'; import { circleCIApiRef } from '../../api'; @@ -30,11 +45,15 @@ export const settings = { }: SettingsState & { doPersist: boolean }) { if (doPersist) dispatch.settings.persist(credentials); }, + setRehydrateError(state: SettingsState, payload: Error | null) { + return { ...state, rehydrateError: payload }; + }, persist(credentials: SettingsState) { sessionStorage.setItem(STORAGE_KEY, JSON.stringify(credentials)); }, rehydrate(_: any, state: iRootState) { try { + dispatch.settings.setRehydrateError(null); const stateFromStorage = JSON.parse( sessionStorage.getItem(STORAGE_KEY)!, ); @@ -49,7 +68,7 @@ export const settings = { doPersist: false, }); } catch (e) { - console.log(e); + dispatch.settings.setRehydrateError(e); } }, }), diff --git a/plugins/circleci/src/state/store.ts b/plugins/circleci/src/state/store.ts index 43b447bf9c..503a2e9b73 100644 --- a/plugins/circleci/src/state/store.ts +++ b/plugins/circleci/src/state/store.ts @@ -1,3 +1,18 @@ +/* + * Copyright 2020 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import { init, RematchRootState, RematchDispatch } from '@rematch/core'; import { models, RootModel } from './models';