Hi guys, in this lesson we will implement storage s with using Wix. wi x is a state management pattern, we can think like it we have an instance or OSHA Thrall application. Then we can change this instance as controls with actions. We can say it shortly our state is stored in an object called the stock. To modify the state will use actions and mutations, which are also stored in the start. State is the data stored in our application.
Getters computed properties based on the store state and action contains business logic and it does not care about updating to state directly to update a state, we will need to commit a mutation. Now, let's start with actions. Our first action will be success, we will use it for success alert message. In all action methods, we have default commit parameters. We will use it to update the state. When we commit it, mutation methods will be called.
So in react, we have self menu control on each step of state. Now, we will create success method under mutations and we will change state video Then we will create edit function then we will create clear function Finally, we will create a get a computed function like bootstrap LS di. Okay, that's all about storage. Yes. Now we will call it from app That the first of all, we will call state of store under computed, we will create ns function and we will return state of it. Secondly, we will call it a function of stuff.
Then we will create clean alert methods And we will call store action. To call it we will use store dispatch class actually. Then we want to clear message content when router is changed. To do it we will create the listener and watch routers. In view we can create these kind of functions with watch methods watch can be taught like a listener, we will create a route listener function. If it is changed, we will clear the error message.
Finally, in HTML form we will create an alert message box for sure official entered message it is not now Then we will use error and success methods on login and register page when we called user service methods. First of all we will handle error block of handle logging methods to do it we will call start that dispatch function with actually our action name will be ash Secondly, we will handle register page handle register function. In this method first of all we will display success message and to show it we will add set timeout for navigation Then we will add error message to error book according to status of response. Finally we will handle homepage and role function. In this method we will display info and error methods Okay, that's all Thank you