Skip to content

Commit 7674a25

Browse files
committed
Fix: screens petitions
1 parent de4f081 commit 7674a25

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/components/Editor/ScreensSection.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ export default {
202202
url: `/components/${this.selectedScreen}`,
203203
});
204204
205-
this.initializeComponents(response.data.components);
205+
this.initializeComponents(response.data.components, this.selectedScreen);
206206
} catch (error) {
207207
console.error(error);
208208
}

src/stores/components.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export const componentsStore = defineStore("components", {
2424
highlightedComponent: null,
2525
inspectedComponent: null,
2626
toDragComponent: null,
27+
screen: null,
2728
}),
2829
getters: {
2930
componentsTree() {
@@ -59,7 +60,7 @@ export const componentsStore = defineStore("components", {
5960
},
6061
},
6162
actions: {
62-
initializeComponents(components) {
63+
initializeComponents(components, screen) {
6364
let componentsCopy = JSON.parse(JSON.stringify(components));
6465

6566
//replace _id with id
@@ -70,6 +71,8 @@ export const componentsStore = defineStore("components", {
7071
}
7172

7273
this.components = componentsCopy;
74+
75+
this.screen = screen;
7376
},
7477
async placeSelectedComponent(screen) {
7578
if (!this.placeComponent) {
@@ -85,7 +88,10 @@ export const componentsStore = defineStore("components", {
8588
const response = await axios({
8689
method: "POST",
8790
url: "/components/create",
88-
data: plainComponent,
91+
data: {
92+
screen: this.screen,
93+
...plainComponent,
94+
},
8995
});
9096

9197
let componentToPush = JSON.parse(

0 commit comments

Comments
 (0)