Fix updating notification counts on events
This commit is contained in:
parent
ee61b6d24b
commit
2a207fd613
1 changed files with 5 additions and 1 deletions
|
|
@ -53,7 +53,11 @@
|
|||
async function updateUserState() {
|
||||
const response = await fetch("/api/user");
|
||||
const data = await response.json();
|
||||
Alpine.store("user", data);
|
||||
// Update properties instead of replacing the whole store which leverages Alpine's reactivity
|
||||
const store_user = Alpine.store("user");
|
||||
Object.keys(data).forEach(key => {
|
||||
store_user[key] = data[key];
|
||||
});
|
||||
}
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
var popoverTriggerList = [].slice.call(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue