Files
InvoiceShelf/resources/scripts/api/services/bootstrap.service.ts
Darko Gjorgjijoski 71388ec6a5 Rename resources/scripts-v2 to resources/scripts and drop @v2 alias
Now that the legacy v1 frontend (commit 064bdf53) is gone, the v2 directory is the only frontend and the v2 suffix is just noise. Renames resources/scripts-v2 to resources/scripts via git mv (so git records the move as renames, preserving blame and log --follow), then bulk-rewrites the 152 files that imported via @v2/... to use @/scripts/... instead. The existing @ alias (resources/) covers the new path with no extra config needed.

Drops the now-unused @v2 alias from vite.config.js and points the laravel-vite-plugin entry at resources/scripts/main.ts. Updates the only blade reference (resources/views/app.blade.php) to match. The package.json test script (eslint ./resources/scripts) automatically targets the right place after the rename without any edit.

Verified: npm run build exits clean and the Vite warning lines now reference resources/scripts/plugins/i18n.ts, confirming every import resolved through the new path. git log --follow on any moved file walks back through its scripts-v2 history.
2026-04-07 12:50:16 +02:00

56 lines
1.5 KiB
TypeScript

import { client } from '../client'
import { API } from '../endpoints'
import type { User, UserSetting } from '@/scripts/types/domain/user'
import type { Company } from '@/scripts/types/domain/company'
import type { Currency } from '@/scripts/types/domain/currency'
import type { Ability } from '@/scripts/types/domain/role'
export interface MenuItem {
title: string
name: string
link: string
icon: string
group: string
group_label?: string
ability?: string
}
export interface BootstrapResponse {
current_user: User
current_user_settings: Record<string, string>
current_user_abilities: Ability[]
companies: Company[]
current_company: Company | null
current_company_settings: Record<string, string>
current_company_currency: Currency | null
main_menu: MenuItem[]
setting_menu: MenuItem[]
config: Record<string, unknown>
global_settings: Record<string, string>
modules: string[]
admin_mode?: boolean
pending_invitations?: Array<{
token: string
company_name: string
invited_by: string
email: string
}>
}
export interface CurrentCompanyResponse {
data: Company
}
export const bootstrapService = {
async bootstrap(adminMode?: boolean): Promise<BootstrapResponse> {
const url = adminMode ? `${API.BOOTSTRAP}?admin_mode=1` : API.BOOTSTRAP
const { data } = await client.get(url)
return data
},
async getCurrentCompany(): Promise<CurrentCompanyResponse> {
const { data } = await client.get(API.CURRENT_COMPANY)
return data
},
}