Skip to content

Commit

Permalink
fix(ui): folder panel changes don't persist in file workspaces electron
Browse files Browse the repository at this point in the history
  • Loading branch information
flawiddsouza committed Oct 15, 2024
1 parent 31c04eb commit 44fbae1
Showing 1 changed file with 27 additions and 4 deletions.
31 changes: 27 additions & 4 deletions packages/ui/src/components/FolderPanel.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<template>
<div style="margin-left: 1rem; margin-right: 1rem; margin-top: 1rem; max-width: 600px;" v-if="collectionItem">
<div v-if="collectionItem._type === 'request_group'">
<div style="margin-left: 1rem; margin-right: 1rem; margin-top: 1rem; max-width: 600px;" v-if="collectionItemToEdit">
<div v-if="collectionItemToEdit._type === 'request_group'">
<div style="padding-bottom: 1rem"></div>
<div class="request-panel-tabs-context">
<div style="font-weight: 500; margin-bottom: var(--label-margin-bottom)">Headers</div>
<div>
<RequestPanelHeaders
:collection-item="collectionItem"
:collection-item="collectionItemToEdit"
:collection-item-environment-resolved="envVariables"
/>
</div>
Expand All @@ -19,7 +19,7 @@
<div style="font-weight: 500; margin-bottom: var(--label-margin-bottom)">Auth</div>
<div>
<RequestPanelAuth
:collection-item="collectionItem"
:collection-item="collectionItemToEdit"
:collection-item-environment-resolved="envVariables"
:flags="flags"
/>
Expand All @@ -35,6 +35,8 @@
<script>
import RequestPanelHeaders from '../../src/components/RequestPanelHeaders.vue'
import RequestPanelAuth from '../../src/components/RequestPanelAuth.vue'
import { deepClone } from '@/helpers'
import { toRaw } from 'vue'
export default {
directives: {
Expand All @@ -61,6 +63,7 @@ export default {
data() {
return {
envVariables: {},
collectionItemToEdit: null,
}
},
computed: {
Expand All @@ -73,6 +76,13 @@ export default {
immediate: true,
handler() {
this.loadEnvVariables()
this.collectionItemToEdit = deepClone(this.collectionItem)
}
},
collectionItemToEdit: {
deep: true,
handler() {
this.updateCollectionItem(this.collectionItemToEdit)
}
}
},
Expand All @@ -88,6 +98,19 @@ export default {
console.error('Error loading environment variables:', error)
}
},
async updateCollectionItem(collectionItem) {
const result = await this.$store.dispatch('updateCollectionItem', {
collectionId: collectionItem._id,
name: collectionItem.name,
parentId: collectionItem.parentId,
headers: structuredClone(toRaw(collectionItem.headers)),
authentication: structuredClone(toRaw(collectionItem.authentication)),
})
if(result.error) {
return
}
},
}
}
</script>

0 comments on commit 44fbae1

Please sign in to comment.