Posts

Showing posts from January, 2021

function

 function add(a,b) { } add(78,65) a b = parameter  78 65 arguments functionall calling    :: whatever call is arguments whatever i am taking :: function parameter 

project flow

 Step 01  :: localhost:3000 ----> port par application ka path hota hai... application check karega woh ki kaun si hai....  Step 02  :: index.js   ===  what is rendering and where renering <Provider store={store} >    <App /> </Provider>, document.getElementById('root')  Step 03  ::        app,js mein jayega coponent mein uska data lega  aur jo bhi component hai class functional hook hai uske according kaam karega... step 04:  iindex.js mein  store hoga step 05::   store.js helpers ke andar padha hu hai.... root reducer and middleware hai middleware api ke liye use karte hain... rootreducer kya karega::::    step 06::   root reducer par jayenge pehle   :: index.js par hai yeh.... step 7:  ab ismein se kisi bhi reduce rmein chale jao aaap step 8::                action...

react flow action service etc

 Step 01:::  component kahan se khul raha hai.... kauns sa component ,... jis page se component khul raha hai usko comments karke check kar lo ki yeh yahi page hai na... sttep 02::  four types page index.js  new edit show delete ka method hai.... step 03::   index page par reducer ke andar jana hai get all uska reducer -- us action mein jakar check karna hai jisse woh connect ho raha hai.................   list page ke liye automatic call ho jata hai getall wala function.  step 04::  action mein page ke action mein ek getall name ka method call hota hai har page ke action mein isi se data ja raha hai isse browser par .... yeh method   service ko call karega getall ki aur jahan se call hua hai waheen pahunch jayega feegroup mein  getall method mein debugger lagao check karo.........   insepct element nai karoge jab tak tab tak rukega hi nai debugger  Token nai ja raha hoga has many ki errors hongi  id na...

Finalised Documentation for React Flow:;

Step 01  :: :: :: :: ::  In Browser We type --------------     http://localhost:8080/login From here We  will go to the react front end  Step 02  :: :: :: :: ::  Go to app.js  see the routes....... I do not get it in the login... Step 03  :: :: :: :: ::  Go to services in the front end.... go to file ---- user.service.js now go to function login................ now in the function login   we go to the return action::::this::: function login(email, password) {     return fetch(`${BASE_URL}/sign_in`, requestOptions)  ::  this sign_in is the route for the backend   ...... Step 04  :: :: :: :: ::  Go to Backend :::: routes.rb in  check this   sign -in route and see controller and action for that        post "/sign_in", :to => 'sessions#create' session controller and create action Step 05  :: :: :: :: :: now go to session controller create a...

prashant react basic understanding..

 login karenge email id and password .... kahan se jata hai.... jab koi bhi route dalte ho toh ten tarike se ja sakta hai... url mein seedhe dal do  ::: no 01 ya sidebar mein link hoga tab ayega ya npm start se automatically hota hai.. yeh kuch case hain jab request hit hoti hai... jab yeh request hit hoti hai toh kahan jata hai............ firsltly index.js in server..... after that two options.... if router laga hua hai toh alag alag page kholo.... nai toh bydefault app.js se seedhe route chalega.... agar swtich nai dete hain toh ek hi bar mein sare routes render ho jate hain... exact mein check karte hain ......ki slash hi hai kya....... agar aapne switch nai lagaya toh apke sare routes render kar dega... .......................................................... /login se....... swtich pehla route de dega... exact likha hua hai...toh fir exact lega ki .....login kahan likha hai uske age kuch bhi nai lega... ar agar slash nai lete ho... switch mein ehl /login se check karke...

understanding flow and error in project in react

 error 01: error students are not shows  check current_user after byebug :  we will  ek component hai  hardcode data humne dikha diya ab humare pas hardcode data nai hai humne ek store bana diya aur usmein hardcode data dikha diya store: apka jo data hai woh state use karte ho toh waheen rehta hai apne ek store use kar liya usmein store mein kai sare state rakh liye aur usmein data rakh liya....state kai sari hongi action se request bheji data update karne ke liye data par action perform karne ke liye...

condtiions by prashant...

 if (condition) { } else { }

conditions by prashatn

 if (user) { } user ? --- : null user && ---- d = null a = d || 0 user && user.image && user.image.name ? "" : null user && user.image && user.image.name && 

Error in Authorization :: superadmin was not getting in backend after sending the reate new form request by frontned

 .

role in frontend

Note: How to check debugger:: step01:  find the locatstoragessetItem::  step02:  find it in src/_services/user.service.js: step 03: open it and do works.     return fetch(`${BASE_URL}/sign_in`, requestOptions)         .then(handleResponse)         .then(user => {             // store user details and jwt token in local storage to keep user logged in between page refreshes             console.log("User Response", user.data)               if (user && user.status === 200) {                 debugger                 console.log("aaaaaa", user.data)                 localStorage.setItem('user', JSON.stringify(user.data));               }         ...

rails filter

  class LoginsController < ApplicationController skip_before_action :require_login , only: [ :new, :create ] end

User- Roles :: frontend :: Prashant

roles in front end section what condtion should use  in front end  that  we can check roles:: Note01::  Basic concept understaood by prashant  export const Route export default app import {Route} from 'react-router-dom'   PrivateRoute.js export const PrivateRoute = (props) => { const isAuthorized = true return( ? <Route path="/abc" render={() => </Student>} > : <Redirect to="login"> ) } App.js <PrivateRoute  isAuthorized={} /> </Route> Note02::  Basic concept understaood for rest  ({...rest}) Note 03::   ({roles, hj,jjj, ...rest}) const gjhjk(props) Note 04::  App.js return <Router> jijo </Router> Note 06:    a = 2 2=== a ({path, component, h, h, ...rest}) {path: '', component: ''}  = props Note 07:   PrivateRoute.js // This is used to determine if a user is authenticated and // if they are allowed to visit the page they navi...

how to set role in rails :::: https://altalogy.com/blog/rails-6-user-accounts-with-3-types-of-roles/

 https://altalogy.com/blog/rails-6-user-accounts-with-3-types-of-roles/ Authorization – CanCanCan We use CanCanCan gem to restrict access to some parts of the app. Whatsmore, we grant different permissions for specific roles. Add to  Gemfile : gem 'cancancan' Run: $ bundle install Next, use this command to generate ability class: $ rails g cancan:ability You can define abilities in  app/models/ability.rb . But first, we have to set different roles. It’s up to you how you want to define roles. We will use three roles:  superadmin ,  supervisor , and  user . We add three boolean columns for each role in the user model. Let’s start by generating migration: $ rails generate migration add_roles_to_users superadmin_role:boolean supervisor_role:boolean user_role:boolean Before we run the migration, let’s edit it. Open  db/migrate/xxx_add_roles_to_users.rb  and adjust the code: class AddRolesToUsers < ActiveRecord::Migration[5.2] def change ad...

new page create in react project

 make route in backend

complete new method create in react +rails

  Step01:  Make a method in backend:::::   def standard_sections     standards = Standard.all     @standards = standards.paginate(:page => params[:page], :per_page => 10)     return render json: {status: 200, data: {standard_sections: @standards.map { |s| [s.standard, s.sections] }, count: standards.count}, message: "all standards list"}   end ................................ and check it at console and hit postman find the record Step 02:   In newFeeGroup:: add this in actioncreators : create action creators in this...from action creators const actionCreators = {   getStandardSections: standardActions.getstandardSections } Step 03:  component will mount section in this matter::::::   componentWillMount() {     this.props.getStandards();     this.props.getSections();     this.props.getStandardSections();   } Step 04: map to the state function mapState(state) {   const...

In rails : when server is not runnin g and error of pid temporrary file

 Do; delete the temporary files :: delete the temporary folder

do if migration command will not work to an existing table when column add

 migration command : bundle exec rake db:migrate this will work first delete the migration file from sublime or terminal then execute this command 

skool project important concepts

Note01: check api docs and api at the browser http://localhost:3000/apipie check it. old school project school  arvindkushwah9@gmail.com password

Make a complete new secton in react js project front in react and backend in rails

Step 01: make the front end first page :: make the component and see that attendance page is  existing or not and see others pages related to it in rails backend and react frontend make the page Attendence.component make the route of that  export this import this in app.js

form data upload in react project

 https://www.geeksforgeeks.org/file-uploading-in-react-js/