mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-09 00:18:00 +01:00
Merge branch 'main' into fix/api-token-copy
This commit is contained in:
commit
a84775a108
@ -6,6 +6,7 @@ import GeneralSelect from '../../common/GeneralSelect/GeneralSelect';
|
|||||||
import useApplicationsApi from '../../../hooks/api/actions/useApplicationsApi/useApplicationsApi';
|
import useApplicationsApi from '../../../hooks/api/actions/useApplicationsApi/useApplicationsApi';
|
||||||
import useToast from '../../../hooks/useToast';
|
import useToast from '../../../hooks/useToast';
|
||||||
import { IApplication } from '../../../interfaces/application';
|
import { IApplication } from '../../../interfaces/application';
|
||||||
|
import useApplication from '../../../hooks/api/getters/useApplication/useApplication';
|
||||||
|
|
||||||
interface IApplicationUpdateProps {
|
interface IApplicationUpdateProps {
|
||||||
application: IApplication;
|
application: IApplication;
|
||||||
@ -14,19 +15,21 @@ interface IApplicationUpdateProps {
|
|||||||
export const ApplicationUpdate = ({ application }: IApplicationUpdateProps) => {
|
export const ApplicationUpdate = ({ application }: IApplicationUpdateProps) => {
|
||||||
const { storeApplicationMetaData } = useApplicationsApi();
|
const { storeApplicationMetaData } = useApplicationsApi();
|
||||||
const { appName, icon, url, description } = application;
|
const { appName, icon, url, description } = application;
|
||||||
|
const { refetchApplication } = useApplication(appName);
|
||||||
const [localUrl, setLocalUrl] = useState(url || '');
|
const [localUrl, setLocalUrl] = useState(url || '');
|
||||||
const [localDescription, setLocalDescription] = useState(description || '');
|
const [localDescription, setLocalDescription] = useState(description || '');
|
||||||
const { setToastData, setToastApiError } = useToast();
|
const { setToastData, setToastApiError } = useToast();
|
||||||
const commonStyles = useCommonStyles();
|
const commonStyles = useCommonStyles();
|
||||||
|
|
||||||
const handleChange = (
|
const handleChange = async (
|
||||||
evt: ChangeEvent<{ name?: string | undefined; value: unknown }>,
|
evt: ChangeEvent<{ name?: string | undefined; value: unknown }>,
|
||||||
field: string,
|
field: string,
|
||||||
value: string
|
value: string
|
||||||
) => {
|
) => {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
try {
|
try {
|
||||||
storeApplicationMetaData(appName, field, value);
|
await storeApplicationMetaData(appName, field, value);
|
||||||
|
refetchApplication();
|
||||||
setToastData({
|
setToastData({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: 'Updated Successfully',
|
title: 'Updated Successfully',
|
||||||
|
Loading…
Reference in New Issue
Block a user