mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-08-09 21:38:36 +02:00
Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1a555eab63 | ||
|
|
4cdcbf79d7 | ||
|
|
c07b527a1d | ||
|
|
a2031f1d88 | ||
|
|
42fec4831e |
@@ -13,8 +13,8 @@ android {
|
|||||||
applicationId "com.audiobookshelf.app"
|
applicationId "com.audiobookshelf.app"
|
||||||
minSdkVersion rootProject.ext.minSdkVersion
|
minSdkVersion rootProject.ext.minSdkVersion
|
||||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||||
versionCode 56
|
versionCode 58
|
||||||
versionName "0.9.36-beta"
|
versionName "0.9.38-beta"
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
aaptOptions {
|
aaptOptions {
|
||||||
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
|
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ class AudiobookProgressSyncer constructor(playerNotificationService:PlayerNotifi
|
|||||||
var listeningTimerRunning:Boolean = false
|
var listeningTimerRunning:Boolean = false
|
||||||
|
|
||||||
private var webviewOpenOnStart:Boolean = false
|
private var webviewOpenOnStart:Boolean = false
|
||||||
|
private var webviewClosedMidSession:Boolean = false
|
||||||
private var listeningBookTitle:String? = ""
|
private var listeningBookTitle:String? = ""
|
||||||
private var listeningBookIsLocal:Boolean = false
|
private var listeningBookIsLocal:Boolean = false
|
||||||
private var listeningBookId:String? = ""
|
private var listeningBookId:String? = ""
|
||||||
@@ -54,9 +55,16 @@ class AudiobookProgressSyncer constructor(playerNotificationService:PlayerNotifi
|
|||||||
listeningTimerTask = Timer("ListeningTimer", false).schedule(0L, 5000L) {
|
listeningTimerTask = Timer("ListeningTimer", false).schedule(0L, 5000L) {
|
||||||
Handler(Looper.getMainLooper()).post() {
|
Handler(Looper.getMainLooper()).post() {
|
||||||
// Webview was closed while android auto is open - switch to native sync
|
// Webview was closed while android auto is open - switch to native sync
|
||||||
if (!playerNotificationService.getIsWebviewOpen() && webviewOpenOnStart) {
|
var isWebviewOpen = playerNotificationService.getIsWebviewOpen()
|
||||||
|
if (!isWebviewOpen && webviewOpenOnStart) {
|
||||||
Log.d(tag, "Listening Timer: webview closed Switching to native sync tracking")
|
Log.d(tag, "Listening Timer: webview closed Switching to native sync tracking")
|
||||||
webviewOpenOnStart = false
|
webviewOpenOnStart = false
|
||||||
|
webviewClosedMidSession = true
|
||||||
|
lastUpdateTime = System.currentTimeMillis() / 1000L
|
||||||
|
} else if (isWebviewOpen && webviewClosedMidSession) {
|
||||||
|
Log.d(tag, "Listening Timer: webview re-opened Switching back to webview sync tracking")
|
||||||
|
webviewClosedMidSession = false
|
||||||
|
webviewOpenOnStart = true
|
||||||
lastUpdateTime = System.currentTimeMillis() / 1000L
|
lastUpdateTime = System.currentTimeMillis() / 1000L
|
||||||
}
|
}
|
||||||
if (!webviewOpenOnStart && playerNotificationService.currentPlayer.isPlaying) {
|
if (!webviewOpenOnStart && playerNotificationService.currentPlayer.isPlaying) {
|
||||||
@@ -97,7 +105,7 @@ class AudiobookProgressSyncer constructor(playerNotificationService:PlayerNotifi
|
|||||||
// Send sync data only for streaming books
|
// Send sync data only for streaming books
|
||||||
var syncData: JSObject = JSObject()
|
var syncData: JSObject = JSObject()
|
||||||
syncData.put("timeListened", elapsed)
|
syncData.put("timeListened", elapsed)
|
||||||
syncData.put("currentTime", playerNotificationService.getCurrentTime())
|
syncData.put("currentTime", playerNotificationService.getCurrentTime() / 1000)
|
||||||
syncData.put("streamId", listeningStreamId)
|
syncData.put("streamId", listeningStreamId)
|
||||||
syncData.put("audiobookId", listeningBookId)
|
syncData.put("audiobookId", listeningBookId)
|
||||||
sendStreamSyncData(syncData) {
|
sendStreamSyncData(syncData) {
|
||||||
|
|||||||
@@ -674,19 +674,29 @@ class PlayerNotificationService : MediaBrowserServiceCompat() {
|
|||||||
|
|
||||||
// Issue with onenote plus crashing when using local cover art. https://github.com/advplyr/audiobookshelf-app/issues/35
|
// Issue with onenote plus crashing when using local cover art. https://github.com/advplyr/audiobookshelf-app/issues/35
|
||||||
if (currentAudiobookStreamData?.coverUri != null && currentAudiobookStreamData?.isLocal == true) {
|
if (currentAudiobookStreamData?.coverUri != null && currentAudiobookStreamData?.isLocal == true) {
|
||||||
try {
|
var deviceName = Build.DEVICE
|
||||||
Log.d(tag, "CHECKING COVER ${currentAudiobookStreamData?.coverUri}")
|
var deviceMan = Build.MANUFACTURER
|
||||||
var file = DocumentFile.fromTreeUri(ctx, currentAudiobookStreamData!!.coverUri)
|
var deviceModel = Build.MODEL
|
||||||
Log.d(tag, "GOT FILE ${file?.name} | ${file?.type} | Can Read: ${file?.canRead()} |isExternalStorageDocument: ${file?.isExternalStorageDocument}")
|
Log.d(tag, "Checking device $deviceName | Model $deviceModel | Manufacturer $deviceMan")
|
||||||
if (file?.canRead() !== true) {
|
if (deviceMan.toLowerCase().contains("oneplus") || deviceName.toLowerCase().contains("oneplus")) {
|
||||||
Log.d(tag, "Invalid cover: no read access")
|
Log.d(tag, "Detected OnePlus device - removing local cover")
|
||||||
currentAudiobookStreamData?.clearCover()
|
|
||||||
}
|
|
||||||
} catch(e:Exception) {
|
|
||||||
Log.d(tag, "Invalid cover: Failed to read local cover file $e")
|
|
||||||
currentAudiobookStreamData?.clearCover()
|
currentAudiobookStreamData?.clearCover()
|
||||||
e.printStackTrace()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// OnePlus devices were showing valid permissions for image
|
||||||
|
// try {
|
||||||
|
// Log.d(tag, "CHECKING COVER ${currentAudiobookStreamData?.coverUri}")
|
||||||
|
// var file = DocumentFile.fromTreeUri(ctx, currentAudiobookStreamData!!.coverUri)
|
||||||
|
// Log.d(tag, "GOT FILE ${file?.name} | ${file?.type} | Can Read: ${file?.canRead()} |isExternalStorageDocument: ${file?.isExternalStorageDocument}")
|
||||||
|
// if (file?.canRead() !== true) {
|
||||||
|
// Log.d(tag, "Invalid cover: no read access")
|
||||||
|
// currentAudiobookStreamData?.clearCover()
|
||||||
|
// }
|
||||||
|
// } catch(e:Exception) {
|
||||||
|
// Log.d(tag, "Invalid cover: Failed to read local cover file $e")
|
||||||
|
// currentAudiobookStreamData?.clearCover()
|
||||||
|
// e.printStackTrace()
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
var metadata = currentAudiobookStreamData!!.getMediaMetadataCompat()
|
var metadata = currentAudiobookStreamData!!.getMediaMetadataCompat()
|
||||||
|
|||||||
@@ -185,15 +185,20 @@ export default {
|
|||||||
return this.book.authorFL
|
return this.book.authorFL
|
||||||
},
|
},
|
||||||
chapters() {
|
chapters() {
|
||||||
return this.audiobook ? this.audiobook.chapters || [] : []
|
return (this.audiobook ? this.audiobook.chapters || [] : []).map((chapter) => {
|
||||||
|
var chap = { ...chapter }
|
||||||
|
chap.start = Number(chap.start)
|
||||||
|
chap.end = Number(chap.end)
|
||||||
|
return chap
|
||||||
|
})
|
||||||
},
|
},
|
||||||
currentChapter() {
|
currentChapter() {
|
||||||
if (!this.audiobook || !this.chapters.length) return null
|
if (!this.audiobook || !this.chapters.length) return null
|
||||||
return this.chapters.find((ch) => Number(ch.start.toFixed(2)) <= this.currentTime && Number(ch.end.toFixed(2)) > this.currentTime)
|
return this.chapters.find((ch) => Number(Number(ch.start).toFixed(2)) <= this.currentTime && Number(Number(ch.end).toFixed(2)) > this.currentTime)
|
||||||
},
|
},
|
||||||
nextChapter() {
|
nextChapter() {
|
||||||
if (!this.chapters.length) return
|
if (!this.chapters.length) return
|
||||||
return this.chapters.find((c) => Number(c.start.toFixed(2)) > this.currentTime)
|
return this.chapters.find((c) => Number(Number(c.start).toFixed(2)) > this.currentTime)
|
||||||
},
|
},
|
||||||
currentChapterTitle() {
|
currentChapterTitle() {
|
||||||
return this.currentChapter ? this.currentChapter.title : ''
|
return this.currentChapter ? this.currentChapter.title : ''
|
||||||
@@ -336,7 +341,7 @@ export default {
|
|||||||
|
|
||||||
// If 1 second or less into current chapter, then go to previous
|
// If 1 second or less into current chapter, then go to previous
|
||||||
if (this.currentTime - this.currentChapter.start <= 1) {
|
if (this.currentTime - this.currentChapter.start <= 1) {
|
||||||
var currChapterIndex = this.chapters.findIndex((ch) => ch.start <= this.currentTime && ch.end >= this.currentTime)
|
var currChapterIndex = this.chapters.findIndex((ch) => Number(ch.start) <= this.currentTime && Number(ch.end) >= this.currentTime)
|
||||||
if (currChapterIndex > 0) {
|
if (currChapterIndex > 0) {
|
||||||
var prevChapter = this.chapters[currChapterIndex - 1]
|
var prevChapter = this.chapters[currChapterIndex - 1]
|
||||||
this.seek(prevChapter.start)
|
this.seek(prevChapter.start)
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ export default {
|
|||||||
},
|
},
|
||||||
currentChapter() {
|
currentChapter() {
|
||||||
if (!this.audiobook || !this.chapters.length) return null
|
if (!this.audiobook || !this.chapters.length) return null
|
||||||
return this.chapters.find((ch) => ch.start <= this.currentTime && ch.end > this.currentTime)
|
return this.chapters.find((ch) => Number(ch.start) <= this.currentTime && Number(ch.end) > this.currentTime)
|
||||||
},
|
},
|
||||||
socketConnected() {
|
socketConnected() {
|
||||||
return this.$store.state.socketConnected
|
return this.$store.state.socketConnected
|
||||||
|
|||||||
@@ -319,7 +319,6 @@ export default {
|
|||||||
if (this.isFirstInit) return
|
if (this.isFirstInit) return
|
||||||
this.isFirstInit = true
|
this.isFirstInit = true
|
||||||
this.initSizeData()
|
this.initSizeData()
|
||||||
|
|
||||||
await this.loadPage(0)
|
await this.loadPage(0)
|
||||||
var lastBookIndex = Math.min(this.totalEntities, this.shelvesPerPage * this.entitiesPerShelf)
|
var lastBookIndex = Math.min(this.totalEntities, this.shelvesPerPage * this.entitiesPerShelf)
|
||||||
this.mountEntites(0, lastBookIndex)
|
this.mountEntites(0, lastBookIndex)
|
||||||
|
|||||||
+2
-1
@@ -56,7 +56,8 @@ export default {
|
|||||||
this.initSocketListeners()
|
this.initSocketListeners()
|
||||||
|
|
||||||
// Load libraries
|
// Load libraries
|
||||||
this.$store.dispatch('libraries/load')
|
await this.$store.dispatch('libraries/load')
|
||||||
|
this.$eventBus.$emit('library-changed')
|
||||||
this.$store.dispatch('libraries/fetch', this.currentLibraryId)
|
this.$store.dispatch('libraries/fetch', this.currentLibraryId)
|
||||||
} else {
|
} else {
|
||||||
this.removeSocketListeners()
|
this.removeSocketListeners()
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "audiobookshelf-app",
|
"name": "audiobookshelf-app",
|
||||||
"version": "0.9.36-beta",
|
"version": "0.9.38-beta",
|
||||||
"author": "advplyr",
|
"author": "advplyr",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "nuxt --hostname localhost --port 1337",
|
"dev": "nuxt --hostname localhost --port 1337",
|
||||||
|
|||||||
@@ -18,10 +18,7 @@
|
|||||||
<span class="material-icons text-error text-lg">cloud_off</span>
|
<span class="material-icons text-error text-lg">cloud_off</span>
|
||||||
<p class="pl-2 text-error text-sm">Audiobookshelf server not connected.</p>
|
<p class="pl-2 text-error text-sm">Audiobookshelf server not connected.</p>
|
||||||
</div>
|
</div>
|
||||||
<p class="px-4 text-center text-error absolute bottom-12 left-0 right-0 mx-auto">
|
<p class="px-4 text-center text-error absolute bottom-12 left-0 right-0 mx-auto"><strong>Important!</strong> This app requires that you are running <u>your own server</u> and does not provide any content.</p>
|
||||||
<strong>Important!</strong> This app requires that you are running
|
|
||||||
<u>your own server</u> and does not provide any content.
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="flex justify-center">
|
<div class="flex justify-center">
|
||||||
<ui-btn v-if="!isSocketConnected" small @click="$router.push('/connect')" class="w-32">Connect</ui-btn>
|
<ui-btn v-if="!isSocketConnected" small @click="$router.push('/connect')" class="w-32">Connect</ui-btn>
|
||||||
@@ -136,7 +133,7 @@ export default {
|
|||||||
this.shelves = categories
|
this.shelves = categories
|
||||||
},
|
},
|
||||||
async socketInit(isConnected) {
|
async socketInit(isConnected) {
|
||||||
if (isConnected) {
|
if (isConnected && this.currentLibraryId) {
|
||||||
console.log('Connected - Load from server')
|
console.log('Connected - Load from server')
|
||||||
await this.fetchCategories()
|
await this.fetchCategories()
|
||||||
} else {
|
} else {
|
||||||
@@ -146,8 +143,7 @@ export default {
|
|||||||
this.loading = false
|
this.loading = false
|
||||||
},
|
},
|
||||||
async libraryChanged(libid) {
|
async libraryChanged(libid) {
|
||||||
console.log('Library changed', libid)
|
if (this.isSocketConnected && this.currentLibraryId) {
|
||||||
if (this.isSocketConnected) {
|
|
||||||
await this.fetchCategories()
|
await this.fetchCategories()
|
||||||
} else {
|
} else {
|
||||||
this.shelves = this.downloadOnlyShelves
|
this.shelves = this.downloadOnlyShelves
|
||||||
@@ -246,7 +242,7 @@ export default {
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.initListeners()
|
this.initListeners()
|
||||||
if (this.$server.initialized) {
|
if (this.$server.initialized && this.currentLibraryId) {
|
||||||
this.fetchCategories()
|
this.fetchCategories()
|
||||||
} else {
|
} else {
|
||||||
this.shelves = this.downloadOnlyShelves
|
this.shelves = this.downloadOnlyShelves
|
||||||
|
|||||||
+32
-39
@@ -31,26 +31,22 @@
|
|||||||
<p>No Downloads</p>
|
<p>No Downloads</p>
|
||||||
</div>
|
</div>
|
||||||
<ul v-else class="h-full w-full" role="listbox" aria-labelledby="listbox-label">
|
<ul v-else class="h-full w-full" role="listbox" aria-labelledby="listbox-label">
|
||||||
<template v-for="download in downloadsDownloading">
|
<li v-for="download in downloadsDownloading" :key="download.id" class="text-gray-400 select-none relative px-4 py-5 border-b border-white border-opacity-10 bg-black bg-opacity-10">
|
||||||
<li :key="download.id" class="text-gray-400 select-none relative px-4 py-5 border-b border-white border-opacity-10 bg-black bg-opacity-10">
|
<div class="flex items-center justify-center">
|
||||||
<div class="flex items-center justify-center">
|
<div class="w-3/4">
|
||||||
<div class="w-3/4">
|
<span class="text-xs">({{ downloadingProgress[download.id] || 0 }}%) {{ download.isPreparing ? 'Preparing' : 'Downloading' }}...</span>
|
||||||
<span class="text-xs">({{ downloadingProgress[download.id] || 0 }}%) {{ download.isPreparing ? 'Preparing' : 'Downloading' }}...</span>
|
<p class="font-normal truncate text-sm">{{ download.audiobook.book.title }}</p>
|
||||||
<p class="font-normal truncate text-sm">{{ download.audiobook.book.title }}</p>
|
|
||||||
</div>
|
|
||||||
<div class="flex-grow" />
|
|
||||||
|
|
||||||
<div class="shadow-sm text-white flex items-center justify-center rounded-full animate-spin">
|
|
||||||
<span class="material-icons">refresh</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</li>
|
<div class="flex-grow" />
|
||||||
</template>
|
|
||||||
<template v-for="download in downloadsReady">
|
<div class="shadow-sm text-white flex items-center justify-center rounded-full animate-spin">
|
||||||
<li :key="download.id" class="text-gray-50 select-none relative pr-4 pl-2 py-5 border-b border-white border-opacity-10" @click="jumpToAudiobook(download)">
|
<span class="material-icons">refresh</span>
|
||||||
<modals-downloads-download-item :download="download" @play="playDownload" @delete="clickDeleteDownload" />
|
</div>
|
||||||
</li>
|
</div>
|
||||||
</template>
|
</li>
|
||||||
|
<li v-for="download in downloadsReady" :key="download.id" class="text-gray-50 select-none relative pr-4 pl-2 py-5 border-b border-white border-opacity-10" @click="jumpToAudiobook(download)">
|
||||||
|
<modals-downloads-download-item :download="download" @play="playDownload" @delete="clickDeleteDownload" />
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
@@ -62,29 +58,26 @@
|
|||||||
</div>
|
</div>
|
||||||
<p v-if="isScanning" class="text-center my-8">Scanning Folder..</p>
|
<p v-if="isScanning" class="text-center my-8">Scanning Folder..</p>
|
||||||
<p v-else-if="!mediaScanResults" class="text-center my-8">No Files Found</p>
|
<p v-else-if="!mediaScanResults" class="text-center my-8">No Files Found</p>
|
||||||
<template v-else>
|
<div v-else>
|
||||||
<template v-for="mediaFolder in mediaScanResults.folders">
|
<div v-for="mediaFolder in mediaScanResults.folders" :key="mediaFolder.uri" class="w-full px-2 py-2">
|
||||||
<div :key="mediaFolder.uri" class="w-full px-2 py-2">
|
<div class="flex items-center">
|
||||||
<div class="flex items-center">
|
<span class="material-icons text-base text-white text-opacity-50">folder</span>
|
||||||
<span class="material-icons text-base text-white text-opacity-50">folder</span>
|
<p class="ml-1 py-0.5">{{ mediaFolder.name }}</p>
|
||||||
<p class="ml-1 py-0.5">{{ mediaFolder.name }}</p>
|
|
||||||
</div>
|
|
||||||
<div v-for="mediaFile in mediaFolder.files" :key="mediaFile.uri" class="ml-3 flex items-center">
|
|
||||||
<span class="material-icons text-base text-white text-opacity-50">{{ mediaFile.isAudio ? 'music_note' : 'image' }}</span>
|
|
||||||
<p class="ml-1 py-0.5">{{ mediaFile.name }}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
<div v-for="mediaFile in mediaFolder.files" :key="mediaFile.uri" class="ml-3 flex items-center">
|
||||||
<template v-for="mediaFile in mediaScanResults.files">
|
<span class="material-icons text-base text-white text-opacity-50">{{ mediaFile.isAudio ? 'music_note' : 'image' }}</span>
|
||||||
<div :key="mediaFile.uri" class="w-full px-2 py-2">
|
<p class="ml-1 py-0.5">{{ mediaFile.name }}</p>
|
||||||
<div class="flex items-center">
|
|
||||||
<span class="material-icons text-base text-white text-opacity-50">{{ mediaFile.isAudio ? 'music_note' : 'image' }}</span>
|
|
||||||
<p class="ml-1 py-0.5">{{ mediaFile.name }}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</div>
|
||||||
</template>
|
<div v-for="mediaFile in mediaScanResults.files" :key="mediaFile.uri" class="w-full px-2 py-2">
|
||||||
|
<div class="flex items-center">
|
||||||
|
<span class="material-icons text-base text-white text-opacity-50">{{ mediaFile.isAudio ? 'music_note' : 'image' }}</span>
|
||||||
|
<p class="ml-1 py-0.5">{{ mediaFile.name }}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ class StoreService {
|
|||||||
init() {
|
init() {
|
||||||
this.platform = Capacitor.getPlatform()
|
this.platform = Capacitor.getPlatform()
|
||||||
this.store = CapacitorDataStorageSqlite
|
this.store = CapacitorDataStorageSqlite
|
||||||
console.log('in init ', this.platform)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+1
-1
@@ -18,7 +18,7 @@ export const getters = {
|
|||||||
console.error('No book item id', bookItem)
|
console.error('No book item id', bookItem)
|
||||||
}
|
}
|
||||||
if (process.env.NODE_ENV !== 'production') { // Testing
|
if (process.env.NODE_ENV !== 'production') { // Testing
|
||||||
return `http://localhost:3333/api/books/${bookItem.id}/cover?token=${userToken}&ts=${bookLastUpdate}`
|
// return `http://localhost:3333/api/books/${bookItem.id}/cover?token=${userToken}&ts=${bookLastUpdate}`
|
||||||
}
|
}
|
||||||
|
|
||||||
var url = new URL(`/api/books/${bookItem.id}/cover`, rootState.serverUrl)
|
var url = new URL(`/api/books/${bookItem.id}/cover`, rootState.serverUrl)
|
||||||
|
|||||||
+9
-3
@@ -2,7 +2,7 @@ export const state = () => ({
|
|||||||
libraries: [],
|
libraries: [],
|
||||||
lastLoad: 0,
|
lastLoad: 0,
|
||||||
listeners: [],
|
listeners: [],
|
||||||
currentLibraryId: 'main',
|
currentLibraryId: '',
|
||||||
showModal: false,
|
showModal: false,
|
||||||
folders: [],
|
folders: [],
|
||||||
folderLastUpdate: 0,
|
folderLastUpdate: 0,
|
||||||
@@ -65,17 +65,23 @@ export const actions = {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$axios
|
return this.$axios
|
||||||
.$get(`/api/libraries`)
|
.$get(`/api/libraries`)
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
|
// Set current library
|
||||||
|
if (data.length) {
|
||||||
|
commit('setCurrentLibrary', data[0].id)
|
||||||
|
}
|
||||||
|
|
||||||
commit('set', data)
|
commit('set', data)
|
||||||
commit('setLastLoad')
|
commit('setLastLoad')
|
||||||
|
return true
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error('Failed', error)
|
console.error('Failed', error)
|
||||||
commit('set', [])
|
commit('set', [])
|
||||||
|
return false
|
||||||
})
|
})
|
||||||
return true
|
|
||||||
},
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user