Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
oien
Clouds - Firebase - Movies
Commits
b6f2f0e2
Commit
b6f2f0e2
authored
Jan 09, 2022
by
erlendoeien
Browse files
Fix ui update on last delete
parent
364ae224
Changes
1
Show whitespace changes
Inline
Side-by-side
src/hooks/useWishlist.ts
View file @
b6f2f0e2
...
...
@@ -32,12 +32,7 @@ export default function useWishlist() {
// Easier to simply overwrite entire wishlist in state
const
fetchWishlist
=
()
=>
{
listeners
.
wishlist
=
onValue
(
wishlistRef
,
(
snapshot
)
=>
{
if
(
snapshot
.
exists
())
{
// wishlist.value = Object.entries(snapshot.val()).map(([key, value]) => ({
// [key]: value as number,
// }));
wishlist
.
value
=
snapshot
.
val
();
}
});
};
...
...
@@ -45,14 +40,12 @@ export default function useWishlist() {
onBeforeUnmount
(()
=>
unsubscibeListeners
(
listeners
));
// const isEmpty = computed(() => wishlist.value.length === 0);
const
isEmpty
=
computed
(()
=>
Object
.
keys
(
wishlist
.
value
).
length
===
0
);
const
isEmpty
=
computed
(()
=>
wishlist
.
value
==
null
||
Object
.
keys
(
wishlist
.
value
).
length
===
0
);
const
addWish
=
(
id
:
number
)
=>
{
push
(
wishlistRef
,
id
);
};
//TODO: Fix not updating ui after deleting last wishlist
//TODO: Related to having the wishlist as object and not list?
//TODO: Lookinto if all mounting/unmounting can happen in the views for better loading?
const
deleteWish
=
(
deleteId
:
number
)
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment