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(items.router, tags=["Items"])
|
||||||
api_router_v1.include_router(ocr.router, prefix="/ocr", tags=["OCR"])
|
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(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"])
|
api_router_v1.include_router(chores.router, prefix="/chores", tags=["Chores"])
|
||||||
# Add other v1 endpoint routers here later
|
# Add other v1 endpoint routers here later
|
||||||
# e.g., api_router_v1.include_router(users.router, prefix="/users", tags=["Users"])
|
# e.g., api_router_v1.include_router(users.router, prefix="/users", tags=["Users"])
|
@ -97,16 +97,16 @@ export const API_ENDPOINTS = {
|
|||||||
|
|
||||||
// Financials
|
// Financials
|
||||||
FINANCIALS: {
|
FINANCIALS: {
|
||||||
EXPENSES: '/financials/expenses',
|
EXPENSES: '/api/v1/financials/expenses',
|
||||||
EXPENSE: (id: string) => `/financials/expenses/${id}`,
|
EXPENSE: (id: string) => `/api/v1/financials/expenses/${id}`,
|
||||||
SETTLEMENTS: '/financials/settlements',
|
SETTLEMENTS: '/api/v1/financials/settlements',
|
||||||
SETTLEMENT: (id: string) => `/financials/settlements/${id}`,
|
SETTLEMENT: (id: string) => `/api/v1/financials/settlements/${id}`,
|
||||||
BALANCES: '/financials/balances',
|
BALANCES: '/api/v1/financials/balances',
|
||||||
BALANCE: (userId: string) => `/financials/balances/${userId}`,
|
BALANCE: (userId: string) => `/api/v1/financials/balances/${userId}`,
|
||||||
REPORTS: '/financials/reports',
|
REPORTS: '/api/v1/financials/reports',
|
||||||
REPORT: (id: string) => `/financials/reports/${id}`,
|
REPORT: (id: string) => `/api/v1/financials/reports/${id}`,
|
||||||
CATEGORIES: '/financials/categories',
|
CATEGORIES: '/api/v1/financials/categories',
|
||||||
CATEGORY: (id: string) => `/financials/categories/${id}`,
|
CATEGORY: (id: string) => `/api/v1/financials/categories/${id}`,
|
||||||
},
|
},
|
||||||
|
|
||||||
// Health
|
// Health
|
||||||
|
@ -1,25 +1,27 @@
|
|||||||
import { createApp } from 'vue';
|
import { createApp } from 'vue'
|
||||||
import { createPinia } from 'pinia';
|
import { createPinia } from 'pinia'
|
||||||
import * as Sentry from '@sentry/vue';
|
import * as Sentry from '@sentry/vue'
|
||||||
import { BrowserTracing } from '@sentry/tracing';
|
import { BrowserTracing } from '@sentry/tracing'
|
||||||
import App from './App.vue';
|
import App from './App.vue'
|
||||||
import router from './router';
|
import router from './router'
|
||||||
import { createI18n } from 'vue-i18n';
|
import { createI18n } from 'vue-i18n'
|
||||||
import enMessages from './i18n/en.json'; // Import en.json directly
|
import enMessages from './i18n/en.json' // Import en.json directly
|
||||||
import deMessages from './i18n/de.json';
|
import deMessages from './i18n/de.json'
|
||||||
import frMessages from './i18n/fr.json';
|
import frMessages from './i18n/fr.json'
|
||||||
import esMessages from './i18n/es.json';
|
import esMessages from './i18n/es.json'
|
||||||
|
|
||||||
// Global styles
|
// Global styles
|
||||||
import './assets/main.scss';
|
import './assets/main.scss'
|
||||||
|
|
||||||
// API client (from your axios boot file)
|
// API client (from your axios boot file)
|
||||||
import { api, globalAxios } from '@/services/api'; // Renamed from boot/axios to services/api
|
import { api, globalAxios } from '@/services/api' // Renamed from boot/axios to services/api
|
||||||
import { useAuthStore } from '@/stores/auth';
|
import { useAuthStore } from '@/stores/auth'
|
||||||
|
|
||||||
// Vue I18n setup (from your i18n boot file)
|
// Vue I18n setup (from your i18n boot file)
|
||||||
// // export type MessageLanguages = keyof typeof messages;
|
// // export type MessageLanguages = keyof typeof messages;
|
||||||
// // export type MessageSchema = (typeof messages)['en-US'];
|
// // export type MessageSchema = (typeof messages)['en-US'];
|
||||||
|
// // export type MessageLanguages = keyof typeof messages;
|
||||||
|
// // export type MessageSchema = (typeof messages)['en-US'];
|
||||||
|
|
||||||
// // declare module 'vue-i18n' {
|
// // declare module 'vue-i18n' {
|
||||||
// // export interface DefineLocaleMessage extends MessageSchema {}
|
// // export interface DefineLocaleMessage extends MessageSchema {}
|
||||||
@ -38,11 +40,11 @@ const i18n = createI18n({
|
|||||||
fr: frMessages,
|
fr: frMessages,
|
||||||
es: esMessages,
|
es: esMessages,
|
||||||
},
|
},
|
||||||
});
|
})
|
||||||
|
|
||||||
const app = createApp(App);
|
const app = createApp(App)
|
||||||
const pinia = createPinia();
|
const pinia = createPinia()
|
||||||
app.use(pinia);
|
app.use(pinia)
|
||||||
|
|
||||||
// Initialize Sentry
|
// Initialize Sentry
|
||||||
Sentry.init({
|
Sentry.init({
|
||||||
@ -59,22 +61,22 @@ Sentry.init({
|
|||||||
tracesSampleRate: 1.0,
|
tracesSampleRate: 1.0,
|
||||||
// Set environment
|
// Set environment
|
||||||
environment: import.meta.env.MODE,
|
environment: import.meta.env.MODE,
|
||||||
});
|
})
|
||||||
|
|
||||||
// Initialize auth state before mounting the app
|
// Initialize auth state before mounting the app
|
||||||
const authStore = useAuthStore();
|
const authStore = useAuthStore()
|
||||||
if (authStore.accessToken) {
|
if (authStore.accessToken) {
|
||||||
authStore.fetchCurrentUser().catch(error => {
|
authStore.fetchCurrentUser().catch((error) => {
|
||||||
console.error('Failed to initialize current user state:', error);
|
console.error('Failed to initialize current user state:', error)
|
||||||
// The fetchCurrentUser action handles token clearing on failure.
|
// The fetchCurrentUser action handles token clearing on failure.
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
app.use(router);
|
app.use(router)
|
||||||
app.use(i18n);
|
app.use(i18n)
|
||||||
|
|
||||||
// Make API instance globally available (optional, prefer provide/inject or store)
|
// Make API instance globally available (optional, prefer provide/inject or store)
|
||||||
app.config.globalProperties.$api = api;
|
app.config.globalProperties.$api = api
|
||||||
app.config.globalProperties.$axios = globalAxios; // The original axios instance if needed
|
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 type { Expense, RecurrencePattern } from '@/types/expense'
|
||||||
import { api } from '@/services/api'
|
import { api, API_ENDPOINTS } from '@/services/api'
|
||||||
|
|
||||||
export interface CreateExpenseData {
|
export interface CreateExpenseData {
|
||||||
description: string
|
description: string
|
||||||
@ -32,21 +32,21 @@ export interface UpdateExpenseData extends Partial<CreateExpenseData> {
|
|||||||
|
|
||||||
export const expenseService = {
|
export const expenseService = {
|
||||||
async createExpense(data: CreateExpenseData): Promise<Expense> {
|
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
|
return response.data
|
||||||
},
|
},
|
||||||
|
|
||||||
async updateExpense(id: number, data: UpdateExpenseData): Promise<Expense> {
|
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
|
return response.data
|
||||||
},
|
},
|
||||||
|
|
||||||
async deleteExpense(id: number): Promise<void> {
|
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> {
|
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
|
return response.data
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ export const expenseService = {
|
|||||||
group_id?: number
|
group_id?: number
|
||||||
isRecurring?: boolean
|
isRecurring?: boolean
|
||||||
}): Promise<Expense[]> {
|
}): Promise<Expense[]> {
|
||||||
const response = await api.get<Expense[]>('/expenses', { params })
|
const response = await api.get<Expense[]>(API_ENDPOINTS.FINANCIALS.EXPENSES, { params })
|
||||||
return response.data
|
return response.data
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user