Files
home_automatization/laravel-app/resources/js/routes.js
T
cacto 2c542fe097 Управление типами устройств из UI (список + создание)
Раньше device_types заводились только через сидер — теперь owner может
посмотреть все типы (карточки: иконка по категории, capabilities
тегами, число устройств этого типа) и добавить новый прямо из
интерфейса: код, категория, возможности вводятся тегами (можно
вписать вручную и добавить по Enter/кнопке). Ссылка на список — со
страницы устройств.

DeviceTypePolicy зеркалит остальные Policy (view — всем, create —
только owner). DeviceTypeResource получил devices_count через
whenCounted — опционально, не ломает существующий API-эндпоинт
(там withCount не вызывается, поле просто не появляется).
2026-08-18 03:07:07 +05:00

51 lines
1.6 KiB
JavaScript

// Single source of truth for the app's URLs on the JS side — mirrors
// routes/web.php. The route list here is small and stable enough that a
// full Ziggy (route-name-to-JS) integration would be more machinery than
// the app needs; if the route count grows a lot, revisit that.
export const routes = {
dashboard: '/dashboard',
zones: {
index: '/zones',
show: (id) => `/zones/${id}`,
create: '/zones/create',
store: '/zones',
edit: (id) => `/zones/${id}/edit`,
update: (id) => `/zones/${id}`,
destroy: (id) => `/zones/${id}`,
},
devices: {
index: '/devices',
show: (id) => `/devices/${id}`,
create: '/devices/create',
store: '/devices',
edit: (id) => `/devices/${id}/edit`,
update: (id) => `/devices/${id}`,
destroy: (id) => `/devices/${id}`,
turnOn: (id) => `/devices/${id}/turn-on`,
turnOff: (id) => `/devices/${id}/turn-off`,
setLevel: (id) => `/devices/${id}/set-level`,
},
deviceTypes: {
index: '/device-types',
create: '/device-types/create',
store: '/device-types',
},
automationRules: {
index: '/automation-rules',
create: '/automation-rules/create',
store: '/automation-rules',
edit: (id) => `/automation-rules/${id}/edit`,
update: (id) => `/automation-rules/${id}`,
destroy: (id) => `/automation-rules/${id}`,
},
profile: {
edit: '/profile',
update: '/profile',
destroy: '/profile',
},
password: {
update: '/password',
},
logout: '/logout',
};