Skip to content

Commit

Permalink
remove alert when loading addons to pevent request blocking
Browse files Browse the repository at this point in the history
  • Loading branch information
pancake3000 committed Feb 7, 2024
1 parent a392bde commit 5eae056
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/components/Configuration.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const stremioAPIBase = "https://api.strem.io/api/"
const stremioAuthKey = ref('')
let addons = ref([])
let loadAddonsButtonText = ref('Load Addons')
const dragging = false
function getCleansedStremioAuthKey() {
Expand All @@ -21,7 +21,7 @@ function loadUserAddons() {
return
}
alert('Loading addons')
loadAddonsButtonText.value = 'Loading...'
console.log('Loading addons...')
const url = `${stremioAPIBase}addonCollectionGet`
Expand All @@ -35,10 +35,17 @@ function loadUserAddons() {
}).then((resp) => {
resp.json().then((data) => {
console.log(data)
if (!("result" in data) || data.result == null) {
console.error("Failed to fetch user addons: ", data)
alert('Failed to fetch user addons - are you sure you pasted the correct Stremio AuthKey?')
return
}
addons.value = data.result.addons
})
}).catch((error) => {
console.error('Error fetching user addons', error)
}).finally(() => {
loadAddonsButtonText.value = 'Load Addons'
})
}
Expand Down Expand Up @@ -84,7 +91,6 @@ function removeAddon(idx) {
function getNestedObjectProperty(obj, path, defaultValue = null) {
try {
console.log('path', path, 'obj', obj, 'defaultValue', defaultValue)
return path.split('.').reduce((acc, part) => acc && acc[part], obj)
} catch (e) {
return defaultValue
Expand All @@ -102,7 +108,7 @@ function getNestedObjectProperty(obj, path, defaultValue = null) {
<p class="grouped">
<input type="password" v-model="stremioAuthKey" placeholder="Paste Stremio AuthKey here...">
<button class="button primary" @click="loadUserAddons">
Load Addons
{{ loadAddonsButtonText }}
</button>
</p>
</fieldset>
Expand Down

0 comments on commit 5eae056

Please sign in to comment.