fix: Avoid crash when an error exist in upload preset request response.

This commit is contained in:
Quentin “Storm1er” Decaunes 2020-03-16 15:58:23 +01:00
parent 6ac94535c0
commit adf7155800
7 changed files with 16 additions and 6 deletions

View File

@ -119,6 +119,11 @@ class PresetButtons extends React.Component<PresetButtonsProps, {}> {
})
);
presetsOnlineContext.update();
})
.catch(() => {
NotificationContext.error(
getTranslation("presetButtons.uploadError", "An error occured while uploading the preset")
);
});
});
};

View File

@ -104,5 +104,6 @@
"appContext.newReleaseAvailable": "有新版本发布,请检查发布标签。",
"PresetOnline.errorLoadingPresets": "无法加载预设。",
"PresetOnline.retryLoadingPresetListBtn": "重试",
"PresetOnline.pleaseCheckInternetConnection": "请检查您的互联网连接。"
"PresetOnline.pleaseCheckInternetConnection": "请检查您的互联网连接。",
"presetButtons.uploadError": "上载预设时发生错误"
}

View File

@ -104,5 +104,6 @@
"appContext.newReleaseAvailable": "Eine neue Version ist verfügbar. Überprüfen Sie die Registerkarte Version.",
"PresetOnline.errorLoadingPresets": "Presets können nicht geladen werden.",
"PresetOnline.retryLoadingPresetListBtn": "Wiederholen",
"PresetOnline.pleaseCheckInternetConnection": "Bitte überprüfe deine Internetverbindung."
"PresetOnline.pleaseCheckInternetConnection": "Bitte überprüfe deine Internetverbindung.",
"presetButtons.uploadError": "Beim Hochladen der Voreinstellung ist ein Fehler aufgetreten"
}

View File

@ -104,5 +104,6 @@
"appContext.newReleaseAvailable": "A new release is available, please check the release tab.",
"PresetOnline.errorLoadingPresets": "Unable to load presets.",
"PresetOnline.retryLoadingPresetListBtn": "Retry",
"PresetOnline.pleaseCheckInternetConnection": "Please check your internet connection."
"PresetOnline.pleaseCheckInternetConnection": "Please check your internet connection.",
"presetButtons.uploadError": "An error occured while uploading the preset"
}

View File

@ -104,5 +104,6 @@
"appContext.newReleaseAvailable": "Une nouvelle version est disponible, vérifiez l'onglet releases.",
"PresetOnline.errorLoadingPresets": "Impossible de charger les presets en ligne.",
"PresetOnline.retryLoadingPresetListBtn": "Réessayer",
"PresetOnline.pleaseCheckInternetConnection": "Veuillez vérifier votre connexion internet."
"PresetOnline.pleaseCheckInternetConnection": "Veuillez vérifier votre connexion internet.",
"presetButtons.uploadError": "Une erreur est survenu lors de l'upload du preset"
}

View File

@ -104,5 +104,6 @@
"appContext.newReleaseAvailable": "Yeni bir sürüm mevcut, lütfen Sürümler sekmesini kontrol edin.",
"PresetOnline.errorLoadingPresets": "Ön ayarlar yüklenemiyor.",
"PresetOnline.retryLoadingPresetListBtn": "Yeniden Dene",
"PresetOnline.pleaseCheckInternetConnection": "Lütfen internet bağlantınızı kontrol edin."
"PresetOnline.pleaseCheckInternetConnection": "Lütfen internet bağlantınızı kontrol edin.",
"presetButtons.uploadError": "Ön ayar yüklenirken bir hata oluştu"
}

View File

@ -32,7 +32,7 @@ class PresetsScene extends React.Component<{}, PresetsOnlineContextType> {
this.isUserAlreadyVotedForThisPreset = this.isUserAlreadyVotedForThisPreset.bind(this);
}
uploadPreset(preset: ApiPreset) {
uploadPreset(preset: ApiPreset): Promise<ApiPreset> {
const requestOption: RequestInit = {
method: "POST",
headers: {