import { createContext, useContext, useEffect, useMemo, useState } from 'react';
import { fetchCurrentUser, postLogin, postLogout } from './api';
const AuthContext = createContext(null);
export function AuthProvider({ children }) {
class ApplicationController < ActionController::Base
before_action :authenticate_user!
rescue_from ActionController::InvalidAuthenticityToken do
handle_unauthenticated(reason: :csrf)
end
import { Turbo } from "@hotwired/turbo-rails"
Turbo.StreamActions.redirect = function () {
const url = this.getAttribute("url")
if (!url) return