Parcourir la source

[web] error handling for BibTeX entry addition using \cite

GitOrigin-RevId: efdf39a959fda7d2f970860051e1fabd72474ab1
Domagoj Kriskovic il y a 4 mois
Parent
commit
4567ffea41

+ 2 - 0
services/web/frontend/extracted-translations.json

@@ -371,6 +371,8 @@
   "copy_response": "",
   "copying": "",
   "cost_summary": "",
+  "could_not_save_reference_to_bib_file": "",
+  "could_not_save_reference_to_bib_file_forbidden": "",
   "country": "",
   "country_flag": "",
   "coupon_code": "",

+ 7 - 0
services/web/frontend/js/infrastructure/fetch-json.ts

@@ -251,3 +251,10 @@ export function isRateLimited(error?: Error | FetchError | any) {
   }
   return false
 }
+
+export function isForbidden(error?: Error | FetchError | any) {
+  if (error && error instanceof FetchError) {
+    return error.response?.status === 403
+  }
+  return false
+}

+ 2 - 0
services/web/locales/en.json

@@ -502,6 +502,8 @@
   "could_not_connect_to_collaboration_server": "Could not connect to collaboration server",
   "could_not_connect_to_websocket_server": "Could not connect to WebSocket server",
   "could_not_load_translations": "Could not load translations",
+  "could_not_save_reference_to_bib_file": "The reference could not be saved to a .bib file.",
+  "could_not_save_reference_to_bib_file_forbidden": "The reference could not be saved to a .bib file. Ask a collaborator with edit access to add it.",
   "country": "Country",
   "country_flag": "__country__ country flag",
   "coupon_code": "Coupon code",