Skip to content

Commit

Permalink
fetch capabilities in external app if not already present, this could…
Browse files Browse the repository at this point in the history
… happen if the url is bookmarked
  • Loading branch information
fschade authored and kulmann committed Oct 29, 2021
1 parent 39f2a77 commit b79add4
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions packages/web-app-external/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,24 @@ import { mapGetters } from 'vuex'
import ErrorScreen from './components/ErrorScreen.vue'
import LoadingScreen from './components/LoadingScreen.vue'
// hacky, get rid asap, just a workaround
// same as packages/web-app-files/src/views/PublicFiles.vue
const unauthenticatedUserReady = async (router, store) => {
if (store.getters.userReady) {
return
}
const publicToken = router.currentRoute.query['public-token']
const publicLinkPassword = store.getters['Files/publicLinkPassword']
await store.dispatch('loadCapabilities', {
publicToken,
...(publicLinkPassword && { user: 'public', password: publicLinkPassword })
})
store.commit('SET_USER_READY', true)
}
export default {
name: 'ExternalApp',
Expand Down Expand Up @@ -70,6 +88,8 @@ export default {
}
},
async created() {
await unauthenticatedUserReady(this.$router, this.$store)
this.loading = true
const publicLinkPassword = this.publicLinkPassword
const { 'public-token': publicToken } = this.$route.query
Expand Down

0 comments on commit b79add4

Please sign in to comment.