mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
Removed unnecessary active theme requests
This commit is contained in:
parent
ab1f175a05
commit
1555b8953f
2 changed files with 0 additions and 6 deletions
|
@ -1,7 +1,6 @@
|
||||||
import InvalidThemeModal, {FatalErrors} from './InvalidThemeModal';
|
import InvalidThemeModal, {FatalErrors} from './InvalidThemeModal';
|
||||||
import NiceModal from '@ebay/nice-modal-react';
|
import NiceModal from '@ebay/nice-modal-react';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import useCustomFonts from '../../../../hooks/useCustomFonts';
|
|
||||||
import {Button, ButtonProps, ConfirmationModal, List, ListItem, Menu, ModalPage, showToast} from '@tryghost/admin-x-design-system';
|
import {Button, ButtonProps, ConfirmationModal, List, ListItem, Menu, ModalPage, showToast} from '@tryghost/admin-x-design-system';
|
||||||
import {JSONError} from '@tryghost/admin-x-framework/errors';
|
import {JSONError} from '@tryghost/admin-x-framework/errors';
|
||||||
import {Theme, isActiveTheme, isDefaultTheme, isDeletableTheme, isLegacyTheme, useActivateTheme, useDeleteTheme} from '@tryghost/admin-x-framework/api/themes';
|
import {Theme, isActiveTheme, isDefaultTheme, isDeletableTheme, isLegacyTheme, useActivateTheme, useDeleteTheme} from '@tryghost/admin-x-framework/api/themes';
|
||||||
|
@ -49,13 +48,11 @@ const ThemeActions: React.FC<ThemeActionProps> = ({
|
||||||
}) => {
|
}) => {
|
||||||
const {mutateAsync: activateTheme} = useActivateTheme();
|
const {mutateAsync: activateTheme} = useActivateTheme();
|
||||||
const {mutateAsync: deleteTheme} = useDeleteTheme();
|
const {mutateAsync: deleteTheme} = useDeleteTheme();
|
||||||
const {refreshActiveThemeData} = useCustomFonts();
|
|
||||||
const handleError = useHandleError();
|
const handleError = useHandleError();
|
||||||
|
|
||||||
const handleActivate = async () => {
|
const handleActivate = async () => {
|
||||||
try {
|
try {
|
||||||
await activateTheme(theme.name);
|
await activateTheme(theme.name);
|
||||||
refreshActiveThemeData();
|
|
||||||
showToast({
|
showToast({
|
||||||
title: 'Theme activated',
|
title: 'Theme activated',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import NiceModal from '@ebay/nice-modal-react';
|
import NiceModal from '@ebay/nice-modal-react';
|
||||||
import React, {ReactNode, useState} from 'react';
|
import React, {ReactNode, useState} from 'react';
|
||||||
import useCustomFonts from '../../../../hooks/useCustomFonts';
|
|
||||||
import {Button, ConfirmationModalContent, Heading, List, ListItem, showToast} from '@tryghost/admin-x-design-system';
|
import {Button, ConfirmationModalContent, Heading, List, ListItem, showToast} from '@tryghost/admin-x-design-system';
|
||||||
import {InstalledTheme, ThemeProblem, useActivateTheme} from '@tryghost/admin-x-framework/api/themes';
|
import {InstalledTheme, ThemeProblem, useActivateTheme} from '@tryghost/admin-x-framework/api/themes';
|
||||||
import {useHandleError} from '@tryghost/admin-x-framework/hooks';
|
import {useHandleError} from '@tryghost/admin-x-framework/hooks';
|
||||||
|
@ -43,7 +42,6 @@ const ThemeInstalledModal: React.FC<{
|
||||||
onActivate?: () => void;
|
onActivate?: () => void;
|
||||||
}> = ({title, prompt, installedTheme, onActivate}) => {
|
}> = ({title, prompt, installedTheme, onActivate}) => {
|
||||||
const {mutateAsync: activateTheme} = useActivateTheme();
|
const {mutateAsync: activateTheme} = useActivateTheme();
|
||||||
const {refreshActiveThemeData} = useCustomFonts();
|
|
||||||
const handleError = useHandleError();
|
const handleError = useHandleError();
|
||||||
|
|
||||||
let errorPrompt = null;
|
let errorPrompt = null;
|
||||||
|
@ -87,7 +85,6 @@ const ThemeInstalledModal: React.FC<{
|
||||||
try {
|
try {
|
||||||
const resData = await activateTheme(installedTheme.name);
|
const resData = await activateTheme(installedTheme.name);
|
||||||
const updatedTheme = resData.themes[0];
|
const updatedTheme = resData.themes[0];
|
||||||
refreshActiveThemeData();
|
|
||||||
|
|
||||||
showToast({
|
showToast({
|
||||||
title: 'Theme activated',
|
title: 'Theme activated',
|
||||||
|
|
Loading…
Reference in a new issue