fix(browser-extension): popup state handler
This commit is contained in:
parent
b3d5bd55d1
commit
317b271dad
@ -60,8 +60,9 @@ const isFirefox = navigator.userAgent.indexOf('Firefox') !== -1;
|
|||||||
|
|
||||||
const handlePowerChange = async () => {
|
const handlePowerChange = async () => {
|
||||||
const state = await dispatch({ hostname, type: 'GET_STATE' });
|
const state = await dispatch({ hostname, type: 'GET_STATE' });
|
||||||
|
const enabled = typeof state?.enabled === 'undefined' ? false : !state.enabled;
|
||||||
|
|
||||||
dispatch({ hostname, state: { enabled: !state?.enabled }, type: 'UPDATE_STATE' });
|
dispatch({ hostname, state: { enabled }, type: 'UPDATE_STATE' });
|
||||||
chrome.tabs.reload({ bypassCache: true });
|
chrome.tabs.reload({ bypassCache: true });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user