CYS - Core: catch error when font installation fails (#44559)

* CYS - Core: catch error when font installation fails

* add changelog

* reduce the requests number
This commit is contained in:
Luigi Teschio 2024-02-13 14:15:52 +01:00 committed by GitHub
parent 75791b2aff
commit 69728b70e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 13 deletions

View File

@ -25,7 +25,6 @@ import {
installFontFace,
installFontFamily,
getFontFamiliesAndFontFaceToInstall,
FontCollectionsResponse,
} from './fonts';
import { COLOR_PALETTES } from '../assembler-hub/sidebar/global-styles/color-palette-variations/constants';
import { FONT_PAIRINGS_WHEN_AI_IS_OFFLINE } from '../assembler-hub/sidebar/global-styles/font-pairing-variations/constants';
@ -93,13 +92,8 @@ const installFontFamilies = async () => {
} )
);
const fontCollections = await apiFetch< FontCollectionsResponse >( {
path: '/wp/v2/font-collections?_fields=slug,name,description,id',
method: 'GET',
} );
const fontCollection = await apiFetch< FontCollectionResponse >( {
path: `/wp/v2/font-collections/${ fontCollections[ 0 ].slug }`,
path: `/wp/v2/font-collections/google-fonts`,
method: 'GET',
} );

View File

@ -180,12 +180,10 @@ export const designWithNoAiStateMachineDefinition = createMachine(
onDone: {
target: 'success',
},
// TODO: Handle error case: https://github.com/woocommerce/woocommerce/issues/43780
// onError: {
// actions: [
// 'assignAPICallLoaderError',
// ],
// },
onError: {
actions:
'redirectToIntroWithError',
},
},
},
success: {

View File

@ -0,0 +1,4 @@
Significance: minor
Type: enhancement
CYS - Core: catch error when font installation fails.