This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import axios from 'axios' | |
| const API_URL = 'http://localhost:3000' | |
| const securedAxiosInstance = axios.create({ | |
| baseURL: API_URL, | |
| withCredentials: true, | |
| headers: { | |
| 'Content-Type': 'application/json' | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | class SignupController < ApplicationController | |
| def create | |
| user = User.new(user_params) | |
| if user.save | |
| payload = { user_id: user.id } | |
| session = JWTSessions::Session.new(payload: payload, refresh_by_access_allowed: true) | |
| tokens = session.login | |
| response.set_cookie(JWTSessions.access_cookie, | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | class SigninController < ApplicationController | |
| before_action :authorize_access_request!, only: [:destroy] | |
| def create | |
| user = User.find_by!(email: params[:email]) | |
| if user.authenticate(params[:password]) | |
| payload = { user_id: user.id } | |
| session = JWTSessions::Session.new(payload: payload, refresh_by_access_allowed: true) | |
| tokens = session.login | |
| response.set_cookie(JWTSessions.access_cookie, |