From eb3787c59b514c133a40ade72c5463c6a98af348 Mon Sep 17 00:00:00 2001 From: Ian Gulliver Date: Thu, 20 Oct 2022 20:53:08 -0700 Subject: [PATCH] Auto-open options page when not configured --- background.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/background.js b/background.js index 6b70db1..710904b 100644 --- a/background.js +++ b/background.js @@ -23,6 +23,12 @@ const activeIcon = { } async function handleClick(tab, e) { + const cfg = await browser.storage.sync.get(); + if (!cfg.token || !cfg.workspace || !cfg.assignee) { + await browser.runtime.openOptionsPage(); + return; + } + if (e.modifiers.includes('Shift')) { await sendPaste(); return; @@ -106,6 +112,10 @@ async function handleChangeInt(e) { } async function create(cfg, task) { + if (!cfg.workspace || !cfg.assignee) { + throw 'missing workspace/assignee'; + } + const req = { data: { workspace: cfg.workspace,