Merge branch 'ph4' of https://github.com/whtvrboo/mitlist into ph4
This commit is contained in:
commit
6306e70df7
@ -19,7 +19,7 @@ api_router_v1.include_router(lists.router, prefix="/lists", tags=["Lists"])
|
||||
api_router_v1.include_router(items.router, tags=["Items"])
|
||||
api_router_v1.include_router(ocr.router, prefix="/ocr", tags=["OCR"])
|
||||
api_router_v1.include_router(costs.router, prefix="/costs", tags=["Costs"])
|
||||
api_router_v1.include_router(financials.router)
|
||||
api_router_v1.include_router(financials.router, prefix="/financials", tags=["Financials"])
|
||||
api_router_v1.include_router(chores.router, prefix="/chores", tags=["Chores"])
|
||||
# Add other v1 endpoint routers here later
|
||||
# e.g., api_router_v1.include_router(users.router, prefix="/users", tags=["Users"])
|
@ -97,16 +97,16 @@ export const API_ENDPOINTS = {
|
||||
|
||||
// Financials
|
||||
FINANCIALS: {
|
||||
EXPENSES: '/financials/expenses',
|
||||
EXPENSE: (id: string) => `/financials/expenses/${id}`,
|
||||
SETTLEMENTS: '/financials/settlements',
|
||||
SETTLEMENT: (id: string) => `/financials/settlements/${id}`,
|
||||
BALANCES: '/financials/balances',
|
||||
BALANCE: (userId: string) => `/financials/balances/${userId}`,
|
||||
REPORTS: '/financials/reports',
|
||||
REPORT: (id: string) => `/financials/reports/${id}`,
|
||||
CATEGORIES: '/financials/categories',
|
||||
CATEGORY: (id: string) => `/financials/categories/${id}`,
|
||||
EXPENSES: '/api/v1/financials/expenses',
|
||||
EXPENSE: (id: string) => `/api/v1/financials/expenses/${id}`,
|
||||
SETTLEMENTS: '/api/v1/financials/settlements',
|
||||
SETTLEMENT: (id: string) => `/api/v1/financials/settlements/${id}`,
|
||||
BALANCES: '/api/v1/financials/balances',
|
||||
BALANCE: (userId: string) => `/api/v1/financials/balances/${userId}`,
|
||||
REPORTS: '/api/v1/financials/reports',
|
||||
REPORT: (id: string) => `/api/v1/financials/reports/${id}`,
|
||||
CATEGORIES: '/api/v1/financials/categories',
|
||||
CATEGORY: (id: string) => `/api/v1/financials/categories/${id}`,
|
||||
},
|
||||
|
||||
// Health
|
||||
|
104
fe/src/main.ts
104
fe/src/main.ts
@ -1,25 +1,27 @@
|
||||
import { createApp } from 'vue';
|
||||
import { createPinia } from 'pinia';
|
||||
import * as Sentry from '@sentry/vue';
|
||||
import { BrowserTracing } from '@sentry/tracing';
|
||||
import App from './App.vue';
|
||||
import router from './router';
|
||||
import { createI18n } from 'vue-i18n';
|
||||
import enMessages from './i18n/en.json'; // Import en.json directly
|
||||
import deMessages from './i18n/de.json';
|
||||
import frMessages from './i18n/fr.json';
|
||||
import esMessages from './i18n/es.json';
|
||||
import { createApp } from 'vue'
|
||||
import { createPinia } from 'pinia'
|
||||
import * as Sentry from '@sentry/vue'
|
||||
import { BrowserTracing } from '@sentry/tracing'
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
import { createI18n } from 'vue-i18n'
|
||||
import enMessages from './i18n/en.json' // Import en.json directly
|
||||
import deMessages from './i18n/de.json'
|
||||
import frMessages from './i18n/fr.json'
|
||||
import esMessages from './i18n/es.json'
|
||||
|
||||
// Global styles
|
||||
import './assets/main.scss';
|
||||
import './assets/main.scss'
|
||||
|
||||
// API client (from your axios boot file)
|
||||
import { api, globalAxios } from '@/services/api'; // Renamed from boot/axios to services/api
|
||||
import { useAuthStore } from '@/stores/auth';
|
||||
import { api, globalAxios } from '@/services/api' // Renamed from boot/axios to services/api
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
|
||||
// Vue I18n setup (from your i18n boot file)
|
||||
// // export type MessageLanguages = keyof typeof messages;
|
||||
// // export type MessageSchema = (typeof messages)['en-US'];
|
||||
// // export type MessageLanguages = keyof typeof messages;
|
||||
// // export type MessageSchema = (typeof messages)['en-US'];
|
||||
|
||||
// // declare module 'vue-i18n' {
|
||||
// // export interface DefineLocaleMessage extends MessageSchema {}
|
||||
@ -29,52 +31,52 @@ import { useAuthStore } from '@/stores/auth';
|
||||
// // export interface DefineNumberFormat {}
|
||||
// // }
|
||||
const i18n = createI18n({
|
||||
legacy: false, // Recommended for Vue 3
|
||||
locale: 'en', // Default locale
|
||||
fallbackLocale: 'en', // Fallback locale
|
||||
messages: {
|
||||
en: enMessages,
|
||||
de: deMessages,
|
||||
fr: frMessages,
|
||||
es: esMessages,
|
||||
},
|
||||
});
|
||||
legacy: false, // Recommended for Vue 3
|
||||
locale: 'en', // Default locale
|
||||
fallbackLocale: 'en', // Fallback locale
|
||||
messages: {
|
||||
en: enMessages,
|
||||
de: deMessages,
|
||||
fr: frMessages,
|
||||
es: esMessages,
|
||||
},
|
||||
})
|
||||
|
||||
const app = createApp(App);
|
||||
const pinia = createPinia();
|
||||
app.use(pinia);
|
||||
const app = createApp(App)
|
||||
const pinia = createPinia()
|
||||
app.use(pinia)
|
||||
|
||||
// Initialize Sentry
|
||||
Sentry.init({
|
||||
app,
|
||||
dsn: import.meta.env.VITE_SENTRY_DSN,
|
||||
integrations: [
|
||||
new BrowserTracing({
|
||||
routingInstrumentation: Sentry.vueRouterInstrumentation(router),
|
||||
tracingOrigins: ['localhost', /^\//],
|
||||
}),
|
||||
],
|
||||
// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
|
||||
// We recommend adjusting this value in production
|
||||
tracesSampleRate: 1.0,
|
||||
// Set environment
|
||||
environment: import.meta.env.MODE,
|
||||
});
|
||||
app,
|
||||
dsn: import.meta.env.VITE_SENTRY_DSN,
|
||||
integrations: [
|
||||
new BrowserTracing({
|
||||
routingInstrumentation: Sentry.vueRouterInstrumentation(router),
|
||||
tracingOrigins: ['localhost', /^\//],
|
||||
}),
|
||||
],
|
||||
// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
|
||||
// We recommend adjusting this value in production
|
||||
tracesSampleRate: 1.0,
|
||||
// Set environment
|
||||
environment: import.meta.env.MODE,
|
||||
})
|
||||
|
||||
// Initialize auth state before mounting the app
|
||||
const authStore = useAuthStore();
|
||||
const authStore = useAuthStore()
|
||||
if (authStore.accessToken) {
|
||||
authStore.fetchCurrentUser().catch(error => {
|
||||
console.error('Failed to initialize current user state:', error);
|
||||
// The fetchCurrentUser action handles token clearing on failure.
|
||||
});
|
||||
authStore.fetchCurrentUser().catch((error) => {
|
||||
console.error('Failed to initialize current user state:', error)
|
||||
// The fetchCurrentUser action handles token clearing on failure.
|
||||
})
|
||||
}
|
||||
|
||||
app.use(router);
|
||||
app.use(i18n);
|
||||
app.use(router)
|
||||
app.use(i18n)
|
||||
|
||||
// Make API instance globally available (optional, prefer provide/inject or store)
|
||||
app.config.globalProperties.$api = api;
|
||||
app.config.globalProperties.$axios = globalAxios; // The original axios instance if needed
|
||||
app.config.globalProperties.$api = api
|
||||
app.config.globalProperties.$axios = globalAxios // The original axios instance if needed
|
||||
|
||||
app.mount('#app');
|
||||
app.mount('#app')
|
||||
|
@ -1,5 +1,5 @@
|
||||
import type { Expense, RecurrencePattern } from '@/types/expense'
|
||||
import { api } from '@/services/api'
|
||||
import { api, API_ENDPOINTS } from '@/services/api'
|
||||
|
||||
export interface CreateExpenseData {
|
||||
description: string
|
||||
@ -32,21 +32,21 @@ export interface UpdateExpenseData extends Partial<CreateExpenseData> {
|
||||
|
||||
export const expenseService = {
|
||||
async createExpense(data: CreateExpenseData): Promise<Expense> {
|
||||
const response = await api.post<Expense>('/expenses', data)
|
||||
const response = await api.post<Expense>(API_ENDPOINTS.FINANCIALS.EXPENSES, data)
|
||||
return response.data
|
||||
},
|
||||
|
||||
async updateExpense(id: number, data: UpdateExpenseData): Promise<Expense> {
|
||||
const response = await api.put<Expense>(`/expenses/${id}`, data)
|
||||
const response = await api.put<Expense>(API_ENDPOINTS.FINANCIALS.EXPENSE(id.toString()), data)
|
||||
return response.data
|
||||
},
|
||||
|
||||
async deleteExpense(id: number): Promise<void> {
|
||||
await api.delete(`/expenses/${id}`)
|
||||
await api.delete(API_ENDPOINTS.FINANCIALS.EXPENSE(id.toString()))
|
||||
},
|
||||
|
||||
async getExpense(id: number): Promise<Expense> {
|
||||
const response = await api.get<Expense>(`/expenses/${id}`)
|
||||
const response = await api.get<Expense>(API_ENDPOINTS.FINANCIALS.EXPENSE(id.toString()))
|
||||
return response.data
|
||||
},
|
||||
|
||||
@ -55,7 +55,7 @@ export const expenseService = {
|
||||
group_id?: number
|
||||
isRecurring?: boolean
|
||||
}): Promise<Expense[]> {
|
||||
const response = await api.get<Expense[]>('/expenses', { params })
|
||||
const response = await api.get<Expense[]>(API_ENDPOINTS.FINANCIALS.EXPENSES, { params })
|
||||
return response.data
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user