/** * Load the site graph */ import * as types from 'site/types' import FontFaceObserver from 'fontfaceobserver' import actions from 'site/actions' import { dispatch } from 'site/store' export const loadMuseum = () => { processCookie() Promise.all([ loadFonts, actions.site.loadGraph('thelastmuseum'), ]) .then(() => dispatch({ type: types.site.load_site })) } const loadFonts = () => { const fonts = [ new FontFaceObserver('Gruk'), new FontFaceObserver('Gruk Wide', { style: 'italic' }), new FontFaceObserver('Gruk Medium'), ] return Promise.all(fonts.map(font => font.load())) } const processCookie = () => { let cookies try { cookies = document.cookie.split(";") .map(s => s.trim().split('=')) .reduce((lookup, pair) => { lookup[pair[0]] = pair[1] return lookup }, {}) } catch (error) { return } if (cookies._icl_visitor_lang_js) { const language = cookies._icl_visitor_lang_js.split("_")[0] if (language === 'en' || language === 'de') { actions.site.changeLanguage(language) } } }