Save and load custom values
This commit is contained in:
parent
5beece744d
commit
fcea9f5b5f
4 changed files with 8 additions and 7 deletions
|
|
@ -6,24 +6,27 @@ const DebugSettings = ({ type, title, ip, profile, setProfile }) => {
|
|||
|
||||
useEffect(() => {
|
||||
if (profile === 'match') {
|
||||
console.log(ip)
|
||||
console.log(1)
|
||||
|
||||
if (ip) {
|
||||
setValue(ip[type])
|
||||
chrome.storage.sync.set({ [type]: ip[type] })
|
||||
}
|
||||
} else if (profile === 'custom') {
|
||||
console.log(111)
|
||||
console.log(2)
|
||||
chrome.storage.sync.get([type], (result) => {
|
||||
console.log(type)
|
||||
console.log(result)
|
||||
result[type] && setValue(result[type])
|
||||
})
|
||||
} else {
|
||||
} else if (profile !== 'default') {
|
||||
setValue(profiles[profile][type])
|
||||
chrome.storage.sync.set({ [type]: profiles[profile][type] })
|
||||
}
|
||||
}, [ip, profile, type])
|
||||
|
||||
const changeTextValue = (e) => {
|
||||
chrome.storage.sync.set({ [type]: e.target.value })
|
||||
chrome.storage.sync.set({ timezone: e.target.value })
|
||||
setValue(e.target.value)
|
||||
chrome.storage.sync.set({ profile: 'custom' })
|
||||
setProfile('custom')
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ const getIP = () =>
|
|||
|
||||
const Popup = () => {
|
||||
const [ip, setIP] = useState(null)
|
||||
const [profile, setProfile] = useState('none')
|
||||
const [profile, setProfile] = useState('default')
|
||||
|
||||
useEffect(() => {
|
||||
chrome.storage.sync.get(['profile', 'ipData'], (result) => {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ const UserAgentSettings = () => {
|
|||
}
|
||||
|
||||
const changeInterval = (e) => {
|
||||
console.log(e.target.value)
|
||||
chrome.storage.sync.set({ interval: e.target.value })
|
||||
setInterval(e.target.value)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
const detachDebugger = () => {
|
||||
chrome.debugger.getTargets((tabs) => {
|
||||
console.log(tabs)
|
||||
for (const tab in tabs) {
|
||||
if (tabs[tab].attached && tabs[tab].tabId) {
|
||||
chrome.debugger.detach({ tabId: tabs[tab].tabId })
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue