init project

This commit is contained in:
@kirill.komarov
2026-04-28 11:02:08 +05:00
commit 55480d4aa5
50 changed files with 9241 additions and 0 deletions
+7
View File
@@ -0,0 +1,7 @@
import axios from 'axios'
import { apiBaseURL } from '@/shared/config'
export const apiClient = axios.create({
baseURL: apiBaseURL,
headers: { 'Content-Type': 'application/json' },
})
+4
View File
@@ -0,0 +1,4 @@
/** Публичный URL API. В dev можно не задавать — запросы идут на тот же origin + прокси Vite (/api → бэкенд). */
export const apiBaseURL = import.meta.env.VITE_API_URL ?? '/api'
export const STORE_NAME = 'Рукодельная лавка'
+13
View File
@@ -0,0 +1,13 @@
const KEY = 'craftshop_admin_token'
export function getAdminToken(): string | null {
return sessionStorage.getItem(KEY)
}
export function setAdminToken(token: string): void {
sessionStorage.setItem(KEY, token)
}
export function clearAdminToken(): void {
sessionStorage.removeItem(KEY)
}
+7
View File
@@ -0,0 +1,7 @@
export function formatPriceRub(priceCents: number): string {
return new Intl.NumberFormat('ru-RU', {
style: 'currency',
currency: 'RUB',
maximumFractionDigits: 0,
}).format(priceCents / 100)
}