File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 1+ import { router } from 'expo-router' ;
12import { useEffect , useState } from 'react' ;
3+ import { showMessage } from 'react-native-flash-message' ;
24
35import { useChallengeState } from '@/data/state/challenge.context' ;
46import type { Challenge } from '@/types/challenge' ;
@@ -11,7 +13,14 @@ export const useAutoChallengeCreation = (callback?: (c: Challenge) => void) => {
1113 const [ alreadyCalled , setAlreadyCalled ] = useState ( false ) ;
1214 useEffect ( ( ) => {
1315 if ( content && difficulty && ! alreadyCalled ) {
14- createChallenge ( callback ) ;
16+ createChallenge ( callback ) . catch ( ( ) => {
17+ showMessage ( {
18+ message : 'Error al crear desafío' ,
19+ description : `Por favor, intenta nuevamente` ,
20+ type : 'danger' ,
21+ } ) ;
22+ router . replace ( '/(challenge)/creation' ) ;
23+ } ) ;
1524 setAlreadyCalled ( true ) ;
1625 }
1726 // eslint-disable-next-line react-hooks/exhaustive-deps
You can’t perform that action at this time.
0 commit comments