Load projects and initialize form with last project and task
This commit is contained in:
@@ -1,11 +1,8 @@
|
||||
import DomainCheck from "./services/DomainCheck"
|
||||
import apiClient from "api/client"
|
||||
import config from "./config"
|
||||
|
||||
apiClient.registerStorage(chrome.storage)
|
||||
apiClient.setClientVersion(chrome.runtime.getManifest().version)
|
||||
|
||||
const domainCheck = new DomainCheck(config)
|
||||
const { version } = chrome.runtime.getManifest()
|
||||
|
||||
chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
|
||||
// run only after the page is fully loaded
|
||||
@@ -16,9 +13,16 @@ chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
|
||||
const service = domainCheck.match(tab.url)
|
||||
|
||||
if (service) {
|
||||
chrome.tabs.sendMessage(tabId, { type: "mountBubble", service }, () => {
|
||||
console.log("bubble mounted")
|
||||
})
|
||||
chrome.storage.sync.get(
|
||||
["subdomain", "apiKey"],
|
||||
({ subdomain, apiKey }) => {
|
||||
const settings = { subdomain, apiKey, version }
|
||||
const payload = { service, settings }
|
||||
chrome.tabs.sendMessage(tabId, { type: "mountBubble", payload }, () => {
|
||||
console.log("bubble mounted")
|
||||
})
|
||||
}
|
||||
)
|
||||
} else {
|
||||
chrome.tabs.sendMessage(tabId, { type: "unmountBubble" }, () => {
|
||||
console.log("bubble unmounted")
|
||||
|
||||
Reference in New Issue
Block a user