dustin-H/telaviv

View on GitHub
src/app/telaviv/index.client.js

Summary

Maintainability
A
0 mins
Test Coverage

import { get } from '../store/store.js'
import { pushLocation } from '../actions/content.js'
import Link from '../../utils/Link.js'
import isActive from './isActive.js'

const IS_SERVER = false
const IS_CLIENT = true
export { IS_SERVER };
export { IS_CLIENT };
export { Link };
export { isActive };

export function setTitle(title) {
  document.title = title
}

export function changeLocation(to) {
  if (to.substr(0, 7) === 'http://' || to.substr(0, 8) === 'https://') {
    window.location.href = to
  } else {
    //let store = get()
    pushLocation(to)
  }
}

export function isLoading() {
  let store = get()
  let state = store.getState()
  return state.content.loading || false
}

export function reload() {
  let store = get()
  pushLocation(store.getState().content.location)
}