- Add translation key 'userDoesNotHavePublicCalendars' to all locale files (en, fr, vi, ru)
- Update ErrorSnackbar to support translation keys in error messages with params
- Update getTempCalendarsListAsync to throw error with translation key format instead of hardcoded message
- Error message now displays user-friendly translated text: '{User Name} does not have public calendars'
This commit is contained in:
@@ -170,7 +170,16 @@ export const getTempCalendarsListAsync = createAsyncThunk<
|
||||
tempUser.openpaasId ?? "",
|
||||
"sharedPublic=true&"
|
||||
)) as Record<string, any>;
|
||||
const rawCalendars = calendars._embedded["dav:calendar"];
|
||||
|
||||
const rawCalendars = calendars._embedded?.["dav:calendar"];
|
||||
if (!rawCalendars || rawCalendars.length === 0) {
|
||||
const userName = tempUser.displayName || tempUser.email || "User";
|
||||
// Format: TRANSLATION:key|param1=value1
|
||||
const encodedName = encodeURIComponent(userName);
|
||||
throw new Error(
|
||||
`TRANSLATION:calendar.userDoesNotHavePublicCalendars|name=${encodedName}`
|
||||
);
|
||||
}
|
||||
|
||||
for (const cal of rawCalendars) {
|
||||
const name = cal["dav:name"];
|
||||
|
||||
Reference in New Issue
Block a user