Add:Nav button in side drawer and item more menu to go to web client #1079

This commit is contained in:
advplyr 2024-03-22 17:54:56 -05:00
parent f04eebe0d8
commit 3c6d4b5f19
24 changed files with 69 additions and 7 deletions

View file

@ -1,3 +1,5 @@
import { Browser } from '@capacitor/browser'
export const state = () => ({
user: null,
serverConnectionConfig: null,
@ -115,6 +117,21 @@ export const actions = {
commit('setSettings', userSettings)
this.$eventBus.$emit('user-settings', state.settings)
}
},
async openWebClient({ getters }, path = null) {
const serverAddress = getters.getServerAddress
if (!serverAddress) {
console.error('openWebClient: No server address')
return
}
try {
let url = serverAddress.replace(/\/$/, '') // Remove trailing slash
if (path?.startsWith('/')) url += path
await Browser.open({ url })
} catch (error) {
console.error('Error opening browser', error)
}
}
}