Skip to content

Commit 6d630d0

Browse files
Fixed Appwrite
1 parent 2a084a1 commit 6d630d0

1 file changed

Lines changed: 18 additions & 21 deletions

File tree

src/App.js

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,29 +24,26 @@ export default function App() {
2424
const categories = [];
2525
const items = [];
2626

27-
const itemsSubscription = client.subscribe.bind(client)([
27+
client.subscribe.bind(client)([
2828
"databases.67c9ffd9003d68236514.collections.67c9ffe6001c17071bb7.documents",
29-
]);
30-
const categoriesSubscription = client.subscribe.bind(client)([
29+
], database.listDocuments('67c9ffe6001c17071bb7').then((response) => {
30+
items.length = 0;
31+
response.documents.forEach((item) => {
32+
items.push(item);
33+
}
34+
);
35+
}));
36+
37+
38+
client.subscribe.bind(client)([
3139
"databases.67c9ffd9003d68236514.collections.67c9ffdd0039c4e09c9a.documents",
32-
]);
33-
34-
categoriesSubscription.then(() => {
35-
database.listDocuments('67c9ffdd0039c4e09c9a').then((response) => {
36-
categories.length = 0;
37-
response.documents.forEach((category) => {
38-
categories.push(category);
39-
});
40-
});
41-
});
42-
itemsSubscription.then(() => {
43-
database.listDocuments('67c9ffe6001c17071bb7').then((response) => {
44-
items.length = 0;
45-
response.documents.forEach((item) => {
46-
items.push(item);
47-
});
48-
});
49-
});
40+
], database.listDocuments('67c9ffdd0039c4e09c9a').then((response) => {
41+
categories.length = 0;
42+
response.documents.forEach((category) => {
43+
categories.push(category);
44+
}
45+
);
46+
}));
5047

5148

5249

0 commit comments

Comments
 (0)