fix: role name is error in role configure (#3618)

This commit is contained in:
katherinehhh 2024-03-05 18:19:53 +08:00 committed by GitHub
parent d708c93b22
commit c5dd034452
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View File

@ -31,7 +31,6 @@ export const useAvailableActions = () => {
export const DataSourceTable = () => { export const DataSourceTable = () => {
const record = useRecord(); const record = useRecord();
console.log(record.key);
return ( return (
<div> <div>
<SchemaComponentContext.Provider value={{ designable: false }}> <SchemaComponentContext.Provider value={{ designable: false }}>

View File

@ -3,12 +3,12 @@ import React, { useContext } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useAPIClient, useRequest, SchemaComponent, useRecord } from '@nocobase/client'; import { useAPIClient, useRequest, SchemaComponent, useRecord } from '@nocobase/client';
import { PermissionContext } from './PermisionProvider'; import { PermissionContext } from './PermisionProvider';
import { CurrentRolesContext } from './';
export const RoleConfigure = () => { export const RoleConfigure = () => {
const { update, currentRecord } = useContext(PermissionContext); const { update } = useContext(PermissionContext);
const { t } = useTranslation(); const { t } = useTranslation();
const { key } = useRecord(); const { key } = useRecord();
return ( return (
<SchemaComponent <SchemaComponent
schema={{ schema={{
@ -18,12 +18,13 @@ export const RoleConfigure = () => {
'x-component-props': { 'x-component-props': {
useValues: (options) => { useValues: (options) => {
const api = useAPIClient(); const api = useAPIClient();
const role = useContext(CurrentRolesContext);
return useRequest( return useRequest(
() => () =>
api api
.resource(`dataSources/${key}/roles`) .resource(`dataSources/${key}/roles`)
.get({ .get({
filterByTk: currentRecord.name, filterByTk: role.name,
}) })
.then((res) => { .then((res) => {
const record = res?.data?.data; const record = res?.data?.data;