init: чистый старт Laravel + Vuexy

This commit is contained in:
2026-02-20 13:30:03 +03:00
commit af53445c26
474 changed files with 58860 additions and 0 deletions

10
resources/ts/utils/api.ts Normal file
View File

@@ -0,0 +1,10 @@
import { ofetch } from 'ofetch'
export const $api = ofetch.create({
baseURL: import.meta.env.VITE_API_BASE_URL || '/api',
async onRequest({ options }) {
const accessToken = useCookie('accessToken').value
if (accessToken)
options.headers.append('Authorization', `Bearer ${accessToken}`)
},
})

View File

@@ -0,0 +1 @@
export const COOKIE_MAX_AGE_1_YEAR = 365 * 24 * 60 * 60

View File

@@ -0,0 +1,6 @@
export const paginationMeta = <T extends { page: number; itemsPerPage: number }>(options: T, total: number) => {
const start = (options.page - 1) * options.itemsPerPage + 1
const end = Math.min(options.page * options.itemsPerPage, total)
return `Showing ${total === 0 ? 0 : start} to ${end} of ${total} entries`
}