This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Component, createEffect, createSignal, For, Show } from 'solid-js'
|
||||
import type { AdminUserInfo } from '../graphql/generated/schema'
|
||||
import type { AdminUserInfo } from '../graphql/generated/graphql'
|
||||
import formStyles from '../styles/Form.module.css'
|
||||
import Button from '../ui/Button'
|
||||
import Modal from '../ui/Modal'
|
||||
@@ -76,7 +76,7 @@ const UserEditModal: Component<UserEditModalProps> = (props) => {
|
||||
email: props.user.email || '',
|
||||
name: props.user.name || '',
|
||||
slug: props.user.slug || '',
|
||||
roles: (props.user.roles || []).map((roleName) => {
|
||||
roles: (props.user.roles || []).map((roleName: string) => {
|
||||
// Сначала пробуем найти по русскому названию (для обратной совместимости)
|
||||
const russianId = ROLE_NAME_TO_ID[roleName]
|
||||
if (russianId) return russianId
|
||||
@@ -119,7 +119,7 @@ const UserEditModal: Component<UserEditModalProps> = (props) => {
|
||||
email: props.user.email || '',
|
||||
name: props.user.name || '',
|
||||
slug: props.user.slug || '',
|
||||
roles: (props.user.roles || []).map((roleName) => {
|
||||
roles: (props.user.roles || []).map((roleName: string) => {
|
||||
// Сначала пробуем найти по русскому названию (для обратной совместимости)
|
||||
const russianId = ROLE_NAME_TO_ID[roleName]
|
||||
if (russianId) return russianId
|
||||
@@ -161,7 +161,7 @@ const UserEditModal: Component<UserEditModalProps> = (props) => {
|
||||
const isCurrentlySelected = currentRoles.includes(roleId)
|
||||
|
||||
const newRoles = isCurrentlySelected
|
||||
? currentRoles.filter((r) => r !== roleId) // Убираем роль
|
||||
? currentRoles.filter((r: string) => r !== roleId) // Убираем роль
|
||||
: [...currentRoles, roleId] // Добавляем роль
|
||||
|
||||
console.log('Current roles before:', currentRoles)
|
||||
@@ -215,7 +215,7 @@ const UserEditModal: Component<UserEditModalProps> = (props) => {
|
||||
await props.onSave({
|
||||
...formData(),
|
||||
// Конвертируем ID ролей обратно в названия для сервера
|
||||
roles: (formData().roles || []).map((roleId) => ROLE_ID_TO_NAME[roleId]).join(',')
|
||||
roles: (formData().roles || []).map((roleId: string) => ROLE_ID_TO_NAME[roleId]).join(',')
|
||||
})
|
||||
props.onClose()
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user