Spencer FengSpencer Feng

All my new posts are on Medium

Hi guys, I am currently writing my posts on Medium, since I think it can help me to reach more audience. If you are interested in my new articles, please check them out there: https://medium.com/@spencerfeng/latest

Read more...

Attach multiple event handlers to an event in Vue.js

Vue.js is a very powerful JavaScript framework which gained lots of popularity in 2017 and I think it will continue to be used in more and more projects this year, so it really is the time to learn Vue.js. In this tutorial, we will learn how to attach multiple event handlers to an event in Vue.js.

You can view the source code for this tutorial on GitHub.

Read more...

Using namespaces and autoloading with Composer in WordPress plugins

In this tutorial, we will learn how to use namespace and autoload with Composer to include classes in WordPress plugins with an example.

You can view the source code for this tutorial on GitHub.

Read more...

Authentication in React Apps with JWT: Part 10

Welcome back! This tutorial will be the last one in this series. In this tutorial, we will retrieve and display member news on the member news page. This tutorial will be broken down into following parts:

  • Create the route which handles the request for member only news
  • Create the memberNews reducer so that we can store member news as a state in the Redux store
  • Create the actions which respond to the member news request event
  • Update the MemberNewPage component so that it can trigger the event of making the request for member news

View the source code for this tutorial on GitHub.

Read more...

Authentication in React Apps with JWT: Part 9

Welcome to the ninth tutorial in our ‘Authentication and Authorisation in React Apps with JSON Web Tokens’ series. Currently, the user is able to create an account, login to and logout from our application, however, there is one thing that we have missed which is that a logged-in user can still access the login and signup page. In this tutorial, we will complete following tasks:

  • Redirect logged-in users to the home page if they try to access the login page
  • Redirect logged-in users to the home page if they try to access the signup page

View the source code for this tutorial on GitHub.

Read more...

Authentication in React Apps with JWT: Part 8

Welcome to the eighth tutorial in our ‘Authentication and Authorisation in React Apps with JSON Web Tokens’ series. Currently, the logout link does nothing in our application. In this tutorial, we will add the function to log a logged-in user out which includes tasks:

  • Clear the JWT token in the localStorage and empty the cUser object in the state
  • Redirect the user to the home page

View the source code for this tutorial on GitHub.

Read more...

Authentication in React Apps with JWT: Part 7

Welcome to the seventh tutorial in our ‘Authentication and Authorisation in React Apps with JSON Web Tokens’ series. Users have been able to signup and login to the application and their login status can be displayed. But, if you refresh the web page when you have logged in, you will see that you are not logged in anymore. So, in this tutorial, we will persist a user’s login status after the web page is refreshed.

  • Create the route on the server side to authenticate a user by a JSON Web Token
  • Create our Redux actions to update the app state after a user is authenticated by a JSON Web Token
  • Dispatch the action

View the source code for this tutorial on GitHub.

Read more...

Authentication in React Apps with JWT: Part 6

Welcome to the sixth tutorial in our ‘Authentication and Authorisation in React Apps with JSON Web Tokens’ series. So far, our app has been able to handle user signup and user login. But there is no way to tell if a user is logged in or not without checking if there is a JWT in the browser’s localStorage. In this post, we have following tasks, so that the users can tell their login status very easily.

  • Show correct navigation menu items and information in the navigation menu bar

View the source code for this tutorial on GitHub.

Read more...

Authentication in React Apps with JWT: Part 5

This is the fifth tutorial in our ‘Authentication and Authorisation in React Apps with JSON Web Tokens’ series. In this tutorial, we will work on the login process:

  • Create the route on the server side to handle user login
  • Create our Redux actions to update the app state after a user logged in
  • Create React components for the login form

View the source code for this tutorial on GitHub.

Read more...

Authentication in React Apps with JWT: Part 4

This is the fourth part of our ‘Authentication and Authorisation in React Apps with JSON Web Tokens’ series. In this part, we will work on the signup process:

  • Create the route on the server side to handle user signup
  • Create our Redux actions to update the app state after a user signed up
  • Create React components for the signup form

View the source code for this tutorial on GitHub.

Read more...
Page 1 of 212
×