<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Front end development Archives - Crosstech IT | Blog</title>
	<atom:link href="https://crosstechit.com/blog/category/front-end-development/feed/" rel="self" type="application/rss+xml" />
	<link>https://crosstechit.com/blog</link>
	<description>Apps. Smart. Fun.</description>
	<lastBuildDate>Sat, 18 Apr 2020 07:35:29 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.9</generator>

<image>
	<url>https://crosstechit.com/blog/wp-content/uploads/2019/01/cropped-favicon-1-32x32.png</url>
	<title>Front end development Archives - Crosstech IT | Blog</title>
	<link>https://crosstechit.com/blog</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Customize/Override Ant Design theme in Laravel ReactJS</title>
		<link>https://crosstechit.com/blog/2020/03/26/customize-override-ant-design-theme-in-laravel-reactjs/</link>
					<comments>https://crosstechit.com/blog/2020/03/26/customize-override-ant-design-theme-in-laravel-reactjs/#respond</comments>
		
		<dc:creator><![CDATA[Daniel Isac]]></dc:creator>
		<pubDate>Thu, 26 Mar 2020 15:10:29 +0000</pubDate>
				<category><![CDATA[Front end development]]></category>
		<guid isPermaLink="false">https://crosstechit.com/blog/2020/03/26/react-js-authentication-with-laravel-back-end-copy/</guid>

					<description><![CDATA[<p>Here&#8217;s a quick guide for overriding Ant Design theme variables (colors) in a ReactJS project using Laravel Mix. I will assume that you already have configured a ReactJS project with Laravel Mix. If not, than you can easily find this documentation: https://laravel.com/docs/master/mix Inspired by AntD documentation here: https://ant.design/docs/react/customize-theme I&#8217;ve managed to make it work in [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://crosstechit.com/blog/2020/03/26/customize-override-ant-design-theme-in-laravel-reactjs/">Customize/Override Ant Design theme in Laravel ReactJS</a> appeared first on <a rel="nofollow" href="https://crosstechit.com/blog">Crosstech IT | Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Here&#8217;s a quick guide for overriding Ant Design theme variables (colors) in a ReactJS project using Laravel Mix. I will assume that you already have configured a ReactJS project with Laravel Mix. If not, than you can easily find this documentation:  <a href="https://laravel.com/docs/master/mix">https://laravel.com/docs/master/mix</a></p>



<p>Inspired by AntD documentation here:  <a href="https://ant.design/docs/react/customize-theme">https://ant.design/docs/react/customize-theme</a> I&#8217;ve managed to make it work in Laravel:</p>



<h2>Let&#8217;s start with dependencies</h2>



<p>First, you have to run the following command</p>



<pre class="wp-block-preformatted">npm install antd 
npm install --save-dev  css-loader  less  less-loader  style-loader</pre>



<h2>Configuring Laravel Mix</h2>



<p>Next, in your project root shall be a file named: <code>webpack.mix.js</code>. At the end of it you shall have something like this:</p>



<pre class="wp-block-preformatted"> 
 mix.react('resources/assets/js/app.js',&nbsp;'public/js')
&nbsp;&nbsp;&nbsp;&nbsp;.less('resources/assets/less/app.less',&nbsp;'public/css',
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;modifyVars:&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'primary-color':&nbsp;'#0BD37E',
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;javascriptEnabled:&nbsp;true,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;});</pre>



<p>Make sure you have <code>app.less</code> created in the desired location.</p>



<p>At the top of that file you should inport the default antd styles using: <code>@import&nbsp;"~antd/dist/antd.less";</code></p>



<p>Rest of your application styling should go below that.</p>



<p>As you can in <code>modifyVars</code> object, we have overwritten the value for primary color.</p>



<p>You can find all other variables with their default values here:  <a href="https://github.com/ant-design/ant-design/blob/master/components/style/themes/default.less">https://github.com/ant-design/ant-design/blob/master/components/style/themes/default.less</a> </p>



<h1>Wrap in up</h1>



<p>Hope these information saved you some time.</p>



<p>If you&#8217;d like to know more details just let me know in comments section.</p>
<p>The post <a rel="nofollow" href="https://crosstechit.com/blog/2020/03/26/customize-override-ant-design-theme-in-laravel-reactjs/">Customize/Override Ant Design theme in Laravel ReactJS</a> appeared first on <a rel="nofollow" href="https://crosstechit.com/blog">Crosstech IT | Blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://crosstechit.com/blog/2020/03/26/customize-override-ant-design-theme-in-laravel-reactjs/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>React JS authentication with Laravel API</title>
		<link>https://crosstechit.com/blog/2019/01/15/react-js-authentication-with-laravel-back-end/</link>
					<comments>https://crosstechit.com/blog/2019/01/15/react-js-authentication-with-laravel-back-end/#comments</comments>
		
		<dc:creator><![CDATA[Daniel Isac]]></dc:creator>
		<pubDate>Tue, 15 Jan 2019 07:00:52 +0000</pubDate>
				<category><![CDATA[Front end development]]></category>
		<guid isPermaLink="false">https://crosstechit.com/blog/?p=42</guid>

					<description><![CDATA[<p>We want to create a consumer web app for our API developed using Laravel Passport and Dingo API. Laravel has it&#8217;s built in webpack for Vue and ReactJS so we can nicely integrate our client app into existing project. Result Here you can find final updated result containing views for: Login Register Forgot password (2 [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://crosstechit.com/blog/2019/01/15/react-js-authentication-with-laravel-back-end/">React JS authentication with Laravel API</a> appeared first on <a rel="nofollow" href="https://crosstechit.com/blog">Crosstech IT | Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>We want to create a consumer web app for our API developed using Laravel Passport and Dingo API.  Laravel has it&#8217;s built in webpack for Vue and ReactJS so we can nicely integrate our client app into existing project.</p>



<h1> Result</h1>



<p>Here you can find final updated result containing views for:</p>



<ul><li>Login</li><li>Register</li><li>Forgot password (2 steps)</li></ul>



<p><a href="https://github.com/danielcrt/laravel-reactjs-passport-authentication">https://github.com/danielcrt/laravel-reactjs-passport-authentication</a></p>



<h1>Setup</h1>



<p>Setup ReactJS inside Laravel project.</p>



<pre class="wp-block-preformatted"> php artisan preset react </pre>



<p>This will remove unnecessary files and prepare the project structure for a React app. You can see in your root directory a file <code>webpack.mix.js</code> where are defined the paths for compiled folders and files.</p>



<pre class="wp-block-preformatted"> <br>mix.react('resources/js/app.js', 'public/js')<br>   .sass('resources/sass/app.scss', 'public/css'); </pre>



<p>So all JS/JSX files from <code>public/js</code> will be compiled to <code>app.js</code>. The same will happen for CSS files.</p>



<p>We want all routes to be handled by React so in <code>routes\web.php</code> we must have:</p>



<h2>View</h2>



<pre class="wp-block-preformatted"> <br>Route::view('/{path?}', 'home')<br>     -&gt;where('path', '.*')<br>     -&gt;name('react');</pre>



<p>This is telling Laravel that for all routes it should return the home view found in <code>resources\views\home.blade.php</code>. In this file it is important to include our compiled CSS and JS files.</p>



<pre class="wp-block-preformatted">&lt;head&gt;<br>    ...<br>    &lt;link rel="stylesheet" href="{{ asset("css/app.css") }}" type="text/css"&gt;<br>&lt;/head&gt;<br>...<br> <br>    &lt;script type="text/javascript" src="{{ asset("js/app.js") }}"&gt;&lt;/script&gt;<br>&lt;/body&gt; </pre>



<h2>Show me React stuff</h2>



<p>In our <code>resources\js\app.js</code> the <code>bootstrap.js</code> file is required by default. And along that we should require our entry point into the app.  In bootstrap file are included jQuery library and bootstrap js  files.  If you don&#8217;t plan to use them you can remove these to lower the build size.</p>



<p>Below that you have some important lines adding  <code> X-Requested-With</code> and <code>X-CSRF-TOKEN</code> headers to axios. If you plan not making requests using axios than you have to handle the by your own. You can prepare the CSRF token for later use in Javascript adding following lines to your view:</p>



<pre class="wp-block-preformatted">&lt;script&gt;<br>    window.Laravel = {!! json_encode([<br>        'csrfToken' =&gt; csrf_token(),<br>    ]) !!};<br>&lt;/script&gt; </pre>



<p>We have used Redux in order to have access to user&#8217;s state all over the app so we wrapped our application in a <code>Provider</code>in <code>js\components\App.jsx</code>. </p>



<p>In <code>js\helpers</code>we have added <code>withCredentials&nbsp;=&nbsp;true</code> to axios configs. This will ensure that the authentication cookie will always be send back to the server. In order to handle the case when user wants to access protected routes without being authenticated we created a interceptor which will remove the local stored variable which tells us if user is logged in (for client side usage) and redirect him to home page.</p>



<pre class="wp-block-preformatted">axios.defaults.withCredentials = true; <br> <br>axios.interceptors.response.use(<br>  response =&gt; response,<br>  (error) =&gt; {<br>    if (error.response.data.status_code === 401) {<br>      // we already know from the server that user is no longer logged in<br>      // just delete the local field<br>      localStorage.removeItem(GlobalConstants.USER_KEY);<br>      history.push('/');<br>    }<br>    return Promise.reject(error);<br>  }); </pre>



<h1>Wrap in up</h1>



<p>That&#8217;s pretty much it. I feel these were the key elements which could save your development time.</p>



<p>If you&#8217;d like me to detail more the project structure and components just let me know in comments section.</p>
<p>The post <a rel="nofollow" href="https://crosstechit.com/blog/2019/01/15/react-js-authentication-with-laravel-back-end/">React JS authentication with Laravel API</a> appeared first on <a rel="nofollow" href="https://crosstechit.com/blog">Crosstech IT | Blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://crosstechit.com/blog/2019/01/15/react-js-authentication-with-laravel-back-end/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
	</channel>
</rss>
