mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 14:43:46 +01:00
Merge pull request #10394 from overleaf/ii-password-reset-and-strength-checking
[web] Password reset strength checking and UI updates GitOrigin-RevId: 442a5c9e7e9d0a61d3ae649f3526bc3c02fd5704
This commit is contained in:
@@ -76,6 +76,10 @@ export class FetchError extends OError {
|
||||
this.data = data
|
||||
}
|
||||
|
||||
getErrorMessageKey() {
|
||||
return this.data?.message?.key as string | undefined
|
||||
}
|
||||
|
||||
getUserFacingMessage() {
|
||||
const statusCode = this.response?.status
|
||||
const defaultMessage = getErrorMessageForStatusCode(statusCode)
|
||||
@@ -210,6 +214,18 @@ async function parseResponseBody(response: Response) {
|
||||
return {}
|
||||
}
|
||||
|
||||
export function getErrorMessageKey(error: Error | null) {
|
||||
if (!error) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
if (error instanceof FetchError) {
|
||||
return error.getErrorMessageKey()
|
||||
}
|
||||
|
||||
return error.message
|
||||
}
|
||||
|
||||
export function getUserFacingMessage(error: Error | null) {
|
||||
if (!error) {
|
||||
return undefined
|
||||
|
||||
Reference in New Issue
Block a user