Enhance gift sending logic: Implement retry mechanism for 'tooOften' error in FalukantService and update error handling in FamilyView to display retry time.
This commit is contained in:
@@ -522,7 +522,8 @@
|
||||
"tooOften": "Du kannst nicht so oft Geschenke machen.",
|
||||
"insufficientFunds": "Du hast nicht genug Geld."
|
||||
},
|
||||
"success": "Das Geschenk wurde überreicht."
|
||||
"success": "Das Geschenk wurde überreicht.",
|
||||
"nextGiftAt": "Nächstes Geschenk ab"
|
||||
}
|
||||
},
|
||||
"product": {
|
||||
|
||||
@@ -197,7 +197,7 @@
|
||||
},
|
||||
"nobility": {
|
||||
"cooldown": "You can only advance again on {date}."
|
||||
},
|
||||
},
|
||||
"branchProduction": {
|
||||
"storageAvailable": "Free storage"
|
||||
},
|
||||
|
||||
@@ -353,8 +353,18 @@ export default {
|
||||
this.$root.$refs.messageDialog.open('tr:falukant.family.sendgift.success');
|
||||
} catch (error) {
|
||||
console.log(error.response);
|
||||
if (error.response.status === 412) {
|
||||
this.$root.$refs.errorDialog.open(`tr:falukant.family.sendgift.error.${error.response.data.error}`);
|
||||
if (error.response?.status === 412) {
|
||||
const retryAtIso = error.response?.data?.retryAt;
|
||||
if (retryAtIso) {
|
||||
const retryStr = new Date(retryAtIso).toLocaleString(navigator.language, {
|
||||
year: 'numeric', month: '2-digit', day: '2-digit',
|
||||
hour: '2-digit', minute: '2-digit'
|
||||
});
|
||||
const baseMsg = this.$t(`falukant.family.sendgift.error.${error.response.data.error}`);
|
||||
this.$root.$refs.errorDialog.open(`${baseMsg} — ${this.$t('falukant.family.sendgift.nextGiftAt')}: ${retryStr}`);
|
||||
} else {
|
||||
this.$root.$refs.errorDialog.open(`tr:falukant.family.sendgift.error.${error.response.data.error}`);
|
||||
}
|
||||
} else {
|
||||
this.$root.$refs.errorDialog.open(`tr:falukant.family.sendgift.error.generic`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user