Trying to fix site loading errors. #104

This commit is contained in:
Dessalines 2020-12-05 20:26:01 -06:00
parent 1b8fe6f6e6
commit 3278576927
2 changed files with 48 additions and 42 deletions

View file

@ -165,7 +165,7 @@ export class Navbar extends Component<NavbarProps, NavbarState> {
// TODO class active corresponding to current page // TODO class active corresponding to current page
navbar() { navbar() {
let user = UserService.Instance.user; let user = this.props.site.my_user;
return ( return (
<nav class="navbar navbar-expand-lg navbar-light shadow-sm p-0 px-3"> <nav class="navbar navbar-expand-lg navbar-light shadow-sm p-0 px-3">
<div class="container"> <div class="container">

View file

@ -521,6 +521,7 @@ export function isPostType(
} }
export function toast(text: string, background: string = 'success') { export function toast(text: string, background: string = 'success') {
if (isBrowser()) {
let backgroundColor = `var(--${background})`; let backgroundColor = `var(--${background})`;
Toastify({ Toastify({
text: text, text: text,
@ -528,6 +529,7 @@ export function toast(text: string, background: string = 'success') {
gravity: 'bottom', gravity: 'bottom',
position: 'left', position: 'left',
}).showToast(); }).showToast();
}
} }
export function pictrsDeleteToast( export function pictrsDeleteToast(
@ -535,6 +537,7 @@ export function pictrsDeleteToast(
deletePictureText: string, deletePictureText: string,
deleteUrl: string deleteUrl: string
) { ) {
if (isBrowser()) {
let backgroundColor = `var(--light)`; let backgroundColor = `var(--light)`;
let toast = Toastify({ let toast = Toastify({
text: clickToDeleteText, text: clickToDeleteText,
@ -551,6 +554,7 @@ export function pictrsDeleteToast(
}, },
close: true, close: true,
}).showToast(); }).showToast();
}
} }
interface NotifyInfo { interface NotifyInfo {
@ -561,6 +565,7 @@ interface NotifyInfo {
} }
export function messageToastify(info: NotifyInfo, router: any) { export function messageToastify(info: NotifyInfo, router: any) {
if (isBrowser()) {
let htmlBody = info.body ? md.render(info.body) : ''; let htmlBody = info.body ? md.render(info.body) : '';
let backgroundColor = `var(--light)`; let backgroundColor = `var(--light)`;
@ -580,6 +585,7 @@ export function messageToastify(info: NotifyInfo, router: any) {
} }
}, },
}).showToast(); }).showToast();
}
} }
export function notifyPost(post: Post, router: any) { export function notifyPost(post: Post, router: any) {