Synced up reload button with match ip and geo data
This commit is contained in:
parent
110962c1ee
commit
8b4ff83708
1 changed files with 12 additions and 6 deletions
|
|
@ -2,7 +2,6 @@ import React, { useState, useEffect } from 'react'
|
||||||
|
|
||||||
const detachDebugger = () => {
|
const detachDebugger = () => {
|
||||||
chrome.debugger.getTargets((tabs) => {
|
chrome.debugger.getTargets((tabs) => {
|
||||||
console.log(tabs)
|
|
||||||
for (const tab in tabs) {
|
for (const tab in tabs) {
|
||||||
if (tabs[tab].attached && tabs[tab].tabId) {
|
if (tabs[tab].attached && tabs[tab].tabId) {
|
||||||
chrome.debugger.detach({ tabId: tabs[tab].tabId })
|
chrome.debugger.detach({ tabId: tabs[tab].tabId })
|
||||||
|
|
@ -12,12 +11,11 @@ const detachDebugger = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const DebugSettings = ({ type, ip }) => {
|
const DebugSettings = ({ type, ip }) => {
|
||||||
const [value, setValue] = useState()
|
const [value, setValue] = useState('')
|
||||||
const [matchIP, setMatchIP] = useState(false)
|
const [matchIP, setMatchIP] = useState(false)
|
||||||
const matchIPStorage = `${type}MatchIP`
|
const matchIPStorage = `${type}MatchIP`
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log('fsffdsfsd')
|
|
||||||
chrome.storage.sync.get([type, matchIPStorage], (result) => {
|
chrome.storage.sync.get([type, matchIPStorage], (result) => {
|
||||||
setMatchIP(result[matchIPStorage])
|
setMatchIP(result[matchIPStorage])
|
||||||
|
|
||||||
|
|
@ -30,6 +28,14 @@ const DebugSettings = ({ type, ip }) => {
|
||||||
})
|
})
|
||||||
}, [ip, matchIPStorage, type])
|
}, [ip, matchIPStorage, type])
|
||||||
|
|
||||||
|
const toggleMatchIP = () => {
|
||||||
|
chrome.storage.sync.set({ [matchIPStorage]: !matchIP })
|
||||||
|
|
||||||
|
if (!matchIP) setValue(ip[type])
|
||||||
|
|
||||||
|
setMatchIP(!matchIP)
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
|
|
@ -44,19 +50,19 @@ const DebugSettings = ({ type, ip }) => {
|
||||||
value={value}
|
value={value}
|
||||||
// onChange={() => setMatchIP(!matchIP)}
|
// onChange={() => setMatchIP(!matchIP)}
|
||||||
style={{
|
style={{
|
||||||
width: '100px',
|
width: '120px',
|
||||||
margin: '0 5px 0 0',
|
margin: '0 5px 0 0',
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{type}
|
{type}
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
Match IP
|
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
checked={matchIP}
|
checked={matchIP}
|
||||||
onChange={() => setMatchIP(!matchIP)}
|
onChange={() => toggleMatchIP()}
|
||||||
/>
|
/>
|
||||||
|
Match IP
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue