Skip to content

Commit 8092431

Browse files
fix: added try/catch
1 parent ed0abb0 commit 8092431

2 files changed

Lines changed: 15 additions & 12 deletions

File tree

src/pages/plugin/plugin.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,6 @@ export default async function PluginInclude(
253253
const oldText = $button.textContent;
254254

255255
try {
256-
257256
if (!product) throw new Error("Product not found");
258257
const apiStatus = await helpers.checkAPIStatus();
259258

src/pages/plugin/plugin.view.js

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -286,23 +286,27 @@ function Buttons({
286286
isSupported = true,
287287
}) {
288288
async function openPluginWebsite() {
289-
const user = await auth.getLoggedInUser();
290-
if (!user) {
289+
try {
290+
const user = await auth.getLoggedInUser();
291+
if (!user) {
292+
CustomTabs.open(
293+
`${config.BASE_URL}/login?redirect=app`,
294+
{ showTitle: true },
295+
() => {},
296+
() => {},
297+
);
298+
return;
299+
}
300+
291301
CustomTabs.open(
292-
`${config.BASE_URL}/login?redirect=app`,
302+
`${config.BASE_URL}/plugin/${id}`,
293303
{ showTitle: true },
294304
() => {},
295305
() => {},
296306
);
297-
return;
307+
} catch (e) {
308+
console.error(e);
298309
}
299-
300-
CustomTabs.open(
301-
`${config.BASE_URL}/plugin/${id}`,
302-
{ showTitle: true },
303-
() => {},
304-
() => {},
305-
);
306310
}
307311
if (!isSupported) {
308312
return (

0 commit comments

Comments
 (0)