Skip to content

Commit

Permalink
Safely check the global appName and handle its inexistence
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
  • Loading branch information
ChristophWurst committed Jun 10, 2021
1 parent 23535c1 commit c59679e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/components/AppContent/AppContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,16 @@ import isMobile from '../../mixins/isMobile'
const browserStorage = getBuilder('nextcloud').persist().build()
let hasGlobalAppName = true
let globalAppName
try {
// This will throw a ReferenceError when the global variable is missing
// In that case we have to make the pane config key required
globalAppName = appName
} catch (e) {
hasGlobalAppName = false
}
/**
* App content container to be used for the main content of your app
*
Expand Down Expand Up @@ -176,7 +186,8 @@ export default {
*/
paneConfigKey: {
type: String,
default: appName,
default: globalAppName,
required: !hasGlobalAppName,
},
/**
Expand Down

0 comments on commit c59679e

Please sign in to comment.