fix: backup fails if user is not pro but encrypted backups is on

(fixes streetwriters/notesnook#781)
This commit is contained in:
thecodrr
2022-08-15 21:11:05 +05:00
parent 988b94fec8
commit d35b2d4250

View File

@@ -29,7 +29,11 @@ export default class Backup {
* @param {boolean} encrypt
*/
async export(type, encrypt = false) {
if (encrypt && !(await checkIsUserPremium(CHECK_IDS.backupEncrypt))) return;
if (encrypt && !(await checkIsUserPremium(CHECK_IDS.backupEncrypt))) {
throw new Error(
"Please upgrade your plan to Pro to use encrypted backups."
);
}
if (!validTypes.some((t) => t === type))
throw new Error("Invalid type. It must be one of 'mobile' or 'web'.");