Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
ensure auth when visiting /shots from addon
Browse files Browse the repository at this point in the history
  • Loading branch information
dannycoates committed Mar 27, 2017
1 parent d63c48a commit ddf6a12
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions addon/webextension/background/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ window.main = (function () {
catcher.watchPromise(analytics.refreshTelemetryPref().then(() => {
sendEvent("goto-myshots", "about-newtab");
}));
catcher.watchPromise(browser.tabs.update({url: backend + "/shots"}));
catcher.watchPromise(
auth.authHeaders()
.then(() => browser.tabs.update({url: backend + "/shots"})));
} else {
catcher.watchPromise(
toggleSelector(tab)
Expand Down Expand Up @@ -110,7 +112,9 @@ window.main = (function () {
});

communication.register("openMyShots", (sender) => {
return browser.tabs.create({url: backend + "/shots"});
return catcher.watchPromise(
auth.authHeaders()
.then(() => browser.tabs.create({url: backend + "/shots"})));
});

communication.register("openShot", (sender, {url, copied}) => {
Expand Down

0 comments on commit ddf6a12

Please sign in to comment.