Skip to content

Commit

Permalink
Fix drag and drop upload
Browse files Browse the repository at this point in the history
  • Loading branch information
G4brym committed Mar 18, 2024
1 parent ace41fc commit 5196ef4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
7 changes: 3 additions & 4 deletions packages/dashboard/src/boot/auth.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import { boot } from 'quasar/wrappers';
import { useAuthStore } from 'stores/auth-store';
import { useMainStore } from "stores/main-store";
import store from 'stores/index'

export default boot(async ({router}) => {
export default boot(async ({router, store}) => {
// Check if theres any auth token stored, if there is, try to fetch or redirect
const authStore = useAuthStore(store());
const authStore = useAuthStore(store);
const authResp = await authStore.CheckLoginInStorage(router);

if (authResp === false) { // No auth token stored, try to fetch without auth or redirect
const mainStore = useMainStore(store())
const mainStore = useMainStore(store)
await mainStore.loadServerConfigs(router, true)
}
});
6 changes: 5 additions & 1 deletion packages/dashboard/src/components/utils/DragAndDrop.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export default {
this.$refs.foldersUploader.click()
},
dragover (event) {
if (this.mainStore.readonly) {
if (this.mainStore.apiReadonly || this.isHover === true) {
return
}
Expand All @@ -75,6 +75,10 @@ export default {
this.isHover = true
},
dragleave (event) {
if (this.isHover === false) {
return
}
if (
event.clientX < this.dragContainer.left ||
event.clientX > this.dragContainer.right ||
Expand Down
4 changes: 2 additions & 2 deletions packages/dashboard/src/stores/main-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { api } from "boot/axios";
export const useMainStore = defineStore('main', {
state: () => ({
// Config
readonly: true,
apiReadonly: true,
dashboardUrl: '',
showHiddenFiles: false,

Expand Down Expand Up @@ -36,7 +36,7 @@ export const useMainStore = defineStore('main', {
}
})

this.readonly = response.data.config.readonly;
this.apiReadonly = response.data.config.readonly;
this.dashboardUrl = response.data.config.dashboardUrl;
this.showHiddenFiles = response.data.config.showHiddenFiles;

Expand Down

0 comments on commit 5196ef4

Please sign in to comment.