File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,6 +37,13 @@ function FlashcardsViewer() {
3737 console . log ( "Re fetched data:" , noteData ) ;
3838 currentContent = noteData . content ;
3939 }
40+
41+ if ( currentContent . trim ( ) . split ( / \s + / ) . length < 70 ) {
42+ toast . error (
43+ "Notes must have at least 70 words! Refresh page to try again."
44+ ) ;
45+ }
46+
4047 const generateFlashcards = httpsCallable ( functions , "generateFlashcards" ) ;
4148 const results = await generateFlashcards ( {
4249 content : getPlainText ( currentContent ) ,
@@ -58,6 +65,10 @@ function FlashcardsViewer() {
5865 } catch ( error ) {
5966 if ( error . code === "functions/resource-exhausted" ) {
6067 setShowNoUsages ( true ) ;
68+ } else if ( error . code === "functions/invalid-argument" ) {
69+ toast . error (
70+ "Notes must have at least 70 words! Refresh page to try again."
71+ ) ;
6172 } else {
6273 console . log ( "Error in flashcards viwer:" , error ) ;
6374 navigate ( "/" ) ;
You can’t perform that action at this time.
0 commit comments