mirror of
https://gitlab.com/bmcgonag/get_my.git
synced 2026-03-27 00:08:49 +00:00
Updating framework to meteor 3 and later
This commit is contained in:
parent
717994508a
commit
cca29bc591
58 changed files with 2332 additions and 1611 deletions
|
|
@ -7,20 +7,27 @@ Template.MainLayout.onCreated(function() {
|
|||
Template.MainLayout.onRendered(function() {
|
||||
this.autorun(() => {
|
||||
let myId = Meteor.userId();
|
||||
let myprefs = UserConfig.findOne({ user: myId });
|
||||
if (typeof myprefs != 'undefined') {
|
||||
if (myprefs.darkMode == "light") {
|
||||
console.log("Found theme as light");
|
||||
Session.set("myTheme", "light");
|
||||
document.documentElement.setAttribute('theme', "light");
|
||||
} else {
|
||||
console.log("Found theme as dark");
|
||||
Session.set("myTheme", "dark");
|
||||
document.documentElement.setAttribute('theme', "dark");
|
||||
}
|
||||
} else {
|
||||
console.log("User Prefs appear undefined.");
|
||||
const getConfig = async() => {
|
||||
let myprefs = await UserConfig.findOneAsync({ user: myId });
|
||||
try {
|
||||
if (!myprefs) {
|
||||
console.log("User Prefs appear undefined.");
|
||||
} else {
|
||||
if (myprefs.darkMode == "light") {
|
||||
console.log("Found theme as light");
|
||||
Session.set("myTheme", "light");
|
||||
document.documentElement.setAttribute('theme', "light");
|
||||
} else {
|
||||
console.log("Found theme as dark");
|
||||
Session.set("myTheme", "dark");
|
||||
document.documentElement.setAttribute('theme', "dark");
|
||||
}
|
||||
}
|
||||
} catch(error) {
|
||||
console.log(" ERROR getting user preferences: " + error);
|
||||
}
|
||||
}
|
||||
getConfig();
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue