Skip to content

Commit

Permalink
change useAgentConfig to useLocalStorage hook at manual testing
Browse files Browse the repository at this point in the history
  • Loading branch information
pavyarov authored and pavyarov committed Apr 29, 2020
1 parent d326ffc commit 739a6d3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@drill4j/browser-extension",
"version": "0.3.8",
"version": "0.3.9",
"license": "Apache-2.0",
"scripts": {
"build": "NODE_ENV=production webpack",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,21 @@ import {
Switch, Route, useHistory,
} from 'react-router-dom';

import { useAgentConfig, useAgentInfo } from '../../../hooks';
import { useLocalStorage, useAgentInfo } from '../../../hooks';

import { StartRecording } from './start-recording';
import { InProgress } from './in-progress';
import { FinishRecording } from './finish-recording';
import { UnavailablePage } from '../unavailable-page';
import { AgentConfig } from '../../../types/agent-config';

export const ManualTestingPage = () => {
const { push, location: { pathname } } = useHistory();
const config = useAgentConfig();
const { [window.location.host]: config } = useLocalStorage<AgentConfig>(window.location.host) || {};
const { status = '' } = useAgentInfo(config?.drillAdminUrl, config?.drillAgentId) || {};

React.useEffect(() => {
if ((status === 'BUSY' || status === 'OFFLINE') && pathname === '/manual-testing') {
if ((status === 'BUSY' || status === 'OFFLINE') && pathname.startsWith('/manual-testing')) {
push('/unavailable-page');
} else if (pathname !== '/unavailable-page' && pathname !== '/test-to-code') {
config?.isActive ? push('/manual-testing/in-progress') : push('/manual-testing');
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Drill4J Browser Extension",
"version": "0.3.8",
"version": "0.3.9",
"background": {
"page": "background.html"
},
Expand Down

0 comments on commit 739a6d3

Please sign in to comment.