chore: align migrations, docs, and frontends with crewli.app setup
- Replace dated migrations with ordered 2026_04_07_* chain; fold users update into base migration - Update OrganisationScope, AppServiceProvider, seeders, api routes, and .env.example - Refresh Cursor rules, CLAUDE.md, Makefile, README, and docs (API, SCHEMA, SETUP) - Adjust admin/app/portal HTML, packages, api-client, events types, and theme config - Update docker-compose and VS Code settings; remove stray Office lock files from resources Made-with: Cursor
This commit is contained in:
@@ -2,6 +2,11 @@ import axios from 'axios'
|
||||
import { parse } from 'cookie-es'
|
||||
import type { AxiosInstance, InternalAxiosRequestConfig } from 'axios'
|
||||
|
||||
/**
|
||||
* Single axios instance for the Laravel API (`VITE_API_URL`, e.g. …/api/v1).
|
||||
* Auth: Bearer token from cookie `accessToken` (set by login).
|
||||
* Use composables built on this client for real API calls; Vuexy `useApi` remains for demos/mocks.
|
||||
*/
|
||||
const apiClient: AxiosInstance = axios.create({
|
||||
baseURL: import.meta.env.VITE_API_URL,
|
||||
headers: {
|
||||
@@ -14,9 +19,7 @@ const apiClient: AxiosInstance = axios.create({
|
||||
function getAccessToken(): string | null {
|
||||
if (typeof document === 'undefined') return null
|
||||
const cookies = parse(document.cookie)
|
||||
const token = cookies.accessToken
|
||||
|
||||
return token ?? null
|
||||
return cookies.accessToken ?? null
|
||||
}
|
||||
|
||||
apiClient.interceptors.request.use(
|
||||
@@ -25,11 +28,9 @@ apiClient.interceptors.request.use(
|
||||
if (token) {
|
||||
config.headers.Authorization = `Bearer ${token}`
|
||||
}
|
||||
|
||||
if (import.meta.env.DEV) {
|
||||
console.log(`🚀 ${config.method?.toUpperCase()} ${config.url}`, config.data)
|
||||
}
|
||||
|
||||
return config
|
||||
},
|
||||
error => Promise.reject(error),
|
||||
@@ -40,26 +41,20 @@ apiClient.interceptors.response.use(
|
||||
if (import.meta.env.DEV) {
|
||||
console.log(`✅ ${response.status} ${response.config.url}`, response.data)
|
||||
}
|
||||
|
||||
return response
|
||||
},
|
||||
error => {
|
||||
if (import.meta.env.DEV) {
|
||||
console.error(
|
||||
`❌ ${error.response?.status} ${error.config?.url}`,
|
||||
error.response?.data,
|
||||
)
|
||||
console.error(`❌ ${error.response?.status} ${error.config?.url}`, error.response?.data)
|
||||
}
|
||||
|
||||
if (error.response?.status === 401) {
|
||||
document.cookie = 'accessToken=; path=/; max-age=0'
|
||||
document.cookie = 'userData=; path=/; max-age=0'
|
||||
document.cookie = 'userAbilityRules=; path=/; max-age=0'
|
||||
if (window.location.pathname !== '/login') {
|
||||
if (typeof window !== 'undefined' && window.location.pathname !== '/login') {
|
||||
window.location.href = '/login'
|
||||
}
|
||||
}
|
||||
|
||||
return Promise.reject(error)
|
||||
},
|
||||
)
|
||||
|
||||
@@ -13,8 +13,8 @@ export interface Pagination {
|
||||
to: number | null
|
||||
}
|
||||
|
||||
/** EventCrew festival / multi-day event (aligned with API `EventResource`). */
|
||||
export type EventCrewEventStatus =
|
||||
/** Crewli festival / multi-day event (aligned with API `EventResource`). */
|
||||
export type CrewliEventStatus =
|
||||
| 'draft'
|
||||
| 'published'
|
||||
| 'registration_open'
|
||||
@@ -37,7 +37,7 @@ export interface Event {
|
||||
start_date: string
|
||||
end_date: string
|
||||
timezone: string
|
||||
status: EventCrewEventStatus
|
||||
status: CrewliEventStatus
|
||||
created_at: string
|
||||
updated_at: string
|
||||
organisation?: OrganisationSummary
|
||||
|
||||
Reference in New Issue
Block a user