(window.webpackJsonp=window.webpackJsonp||[]).push([[8],{147:function(e,t,a){"use strict";a.d(t,"a",function(){return c}),a.d(t,"b",function(){return l});var n=a(69),r=a(15),o=a.n(r),s=a(17),c=function(e,t){return function(a){return o.a.post(s.g,{token:e,store_id:t}).then(function(e){var t=e.data;return a({type:n.a,payload:t})}).catch(function(e){console.log(e)})}},l=function(e,t){return function(a){return o.a.post(s.C,{token:e,store_id:t}).then(function(e){return e.data}).catch(function(e){console.log(e)})}}},224:function(e,t,a){"use strict";a.r(t);var n=a(22),r=a(23),o=a(25),s=a(24),c=a(26),l=a(0),i=a.n(l),u=a(34),d=a(46),m=a(131),g=a.n(m),h=a(147),p=a(6),f=a(3),b=a(197),v=a.n(b),E=function(e){function t(){var e,a;Object(n.a)(this,t);for(var r=arguments.length,c=new Array(r),l=0;l<r;l++)c[l]=arguments[l];return(a=Object(o.a)(this,(e=Object(s.a)(t)).call.apply(e,[this].concat(c)))).state={loading:!1},a.handleSelectStore=function(e){a.setState({loading:!0});var t=a.props.user;new Promise(function(t){localStorage.setItem("selected_store_id",e),localStorage.setItem("storeTabIndex",0),localStorage.setItem("ordersTabIndex",0),t("Saved")}).then(function(){a.props.getDashboardData(t.data.auth_token,e).then(function(){a.context.router.history.push("/")})})},a}return Object(c.a)(t,e),Object(r.a)(t,[{key:"componentDidMount",value:function(){var e=this;document.getElementsByTagName("body")[0].classList.remove("bg-store-light");var t=this.props.user;1===t.data.stores.length&&(this.setState({loading:!0}),console.log("Only one store linked to this store owner... Redirecting to Dashboard"),new Promise(function(e){localStorage.setItem("selected_store_id",t.data.stores[0].id),localStorage.setItem("storeTabIndex",0),localStorage.setItem("ordersTabIndex",0),e("Saved")}).then(function(){e.props.getDashboardData(t.data.auth_token,t.data.stores[0].id).then(function(){e.context.router.history.push("/")})}))}},{key:"componentWillUnmount",value:function(){document.getElementsByTagName("body")[0].classList.add("bg-store-light")}},{key:"render",value:function(){var e=this,t=this.props.user;return t.success?i.a.createElement(i.a.Fragment,null,this.state.loading&&i.a.createElement(p.a,null),i.a.createElement("div",{className:"pageTitle bg-primary-gradient"},i.a.createElement(v.a,null,localStorage.getItem("storeSelectionPage_title"))),i.a.createElement("div",{className:"pageContents"},i.a.createElement("div",{className:"mt-15"},i.a.createElement("div",{className:"storeSelectorBlock"},t.data.stores.map(function(t,a){return i.a.createElement(i.a.Fragment,{key:t.id},i.a.createElement("div",{className:"singleStoreSelector",onClick:function(){return e.handleSelectStore(t.id)}},i.a.createElement("div",{className:"d-flex justify-content-start align-items-center"},i.a.createElement("div",null,i.a.createElement("img",{src:f.a+t.image,alt:t.name,className:"storeSelectorImage"})),i.a.createElement("div",{className:"d-flex justify-content-between align-items-center w-100"},i.a.createElement("div",null,i.a.createElement("span",{className:"storeSelectorName"},t.name),i.a.createElement("br",null),i.a.createElement("span",{className:"text-muted font-w400 storeSelectorDescription"},t.description)),i.a.createElement("span",null,i.a.createElement("i",{className:"si si-arrow-right text-muted"}))),i.a.createElement(g.a,{duration:"500",hasTouch:"true"}))))}))))):i.a.createElement(d.a,{to:"/login"})}}]),t}(l.Component);E.contextTypes={router:function(){return null}};t.default=Object(u.b)(function(e){return{user:e.user.user}},{getDashboardData:h.a})(E)}}]);