Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix backup preparation loading #15

Merged
merged 2 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/photos/ducks/backup/components/BackupActions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ const BackupActions = () => {
if (!backupPermissions) return null

if (backupPermissions.granted) {
if (!backupInfo) return null
if (!backupInfo) {
return <DisabledLoadingBackupButton />
}

const {
currentBackup: { status, mediasToBackupCount, totalMediasToBackupCount }
Expand Down
11 changes: 11 additions & 0 deletions src/photos/ducks/backup/helpers/error.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
const IGNORED_ERRORS = [
'Backup already preparing',
'Copia de seguridad ya se está preparando',
'Sauvegarde déjà en préparation'
]

export const parseBackupError = ({ message }) => {
try {
const parsed = JSON.parse(message)

return {
message: parsed.message,
statusCode: parsed.statusCode
}
} catch {
if (IGNORED_ERRORS.includes(message)) {
return null
}

return {
message
}
Expand Down
Loading