forked from andyburke/autonomous.contact
fix: clean up fixes after APP overhaul
This commit is contained in:
parent
52f46207ec
commit
c34069066d
11 changed files with 76 additions and 88 deletions
|
|
@ -2,6 +2,7 @@ const HASH_EXTRACTOR = /^\#\/topic\/(?<topic_id>[A-Za-z\-]+)\/?(?<view>\w+)?/gm;
|
|||
const UPDATE_TOPICS_FREQUENCY = 60_000;
|
||||
|
||||
const APP = {
|
||||
user: undefined,
|
||||
user_servers: [],
|
||||
user_watches: [],
|
||||
|
||||
|
|
@ -56,16 +57,19 @@ const APP = {
|
|||
groups: {},
|
||||
};
|
||||
|
||||
/*
|
||||
console.dir({
|
||||
url: window.location.href,
|
||||
hash: window.location.hash,
|
||||
topic_id,
|
||||
view,
|
||||
});
|
||||
*/
|
||||
|
||||
if (!document.body.dataset.topic || document.body.dataset.topic !== topic_id) {
|
||||
const previous = document.body.dataset.topic;
|
||||
|
||||
/*
|
||||
console.dir({
|
||||
topic_changed: {
|
||||
detail: {
|
||||
|
|
@ -74,6 +78,7 @@ const APP = {
|
|||
},
|
||||
},
|
||||
});
|
||||
*/
|
||||
|
||||
document.body.dataset.topic = topic_id;
|
||||
|
||||
|
|
@ -94,6 +99,7 @@ const APP = {
|
|||
const previous = document.body.dataset.view;
|
||||
document.body.dataset.view = view;
|
||||
|
||||
/*
|
||||
console.dir({
|
||||
view_changed: {
|
||||
detail: {
|
||||
|
|
@ -102,6 +108,7 @@ const APP = {
|
|||
},
|
||||
},
|
||||
});
|
||||
*/
|
||||
|
||||
this._emit( 'view_changed', {
|
||||
previous,
|
||||
|
|
@ -149,8 +156,9 @@ const APP = {
|
|||
this._emit( 'load', this );
|
||||
},
|
||||
|
||||
update_user: async function( updated_user ) {
|
||||
const user = this.user = updated_user;
|
||||
update_user: async function( user ) {
|
||||
this.user = user;
|
||||
|
||||
document.body.dataset.user = JSON.stringify(user);
|
||||
document.body.dataset.perms = user.permissions.join(":");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue