Creates won-utils method to parse the loginError messages
@@ -729,3 +729,17 @@ export function generateBase64PngQrCode(link) {
const pngQrCode = generatePngQrCode(link);
return pngQrCode && btoa(String.fromCharCode.apply(null, pngQrCode));
}
+
+export function getLoginErrorMessage(loginError) {
+ if (
+ loginError &&
+ loginError.get("code") === won.RESPONSECODE.PRIVATEID_NOT_FOUND
+ ) {
+ return "Sorry, we couldn't find the private ID (the one in your url-bar). If you copied this address make sure you **copied everything** and try **reloading the page**. If this doesn't work you can try [removing it](#) to start fresh.";
+ } else if (loginError) {
+ //return the message FIXME: once the localization is implemented use the correct localization
+ return loginError.get("message");
+ }
+
+ return loginError;
+}
