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

chore: improve apple calendar message #14139

Merged
merged 3 commits into from Mar 19, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion apps/web/public/static/locales/en/common.json
Expand Up @@ -1123,6 +1123,7 @@
"connect_apple_server": "Connect to Apple Server",
"calendar_url": "Calendar URL",
"apple_server_generate_password": "Generate an app specific password to use with {{appName}} at",
"unable_to_add_apple_calendar":"Unable to add this Apple Calendar account. Please ensure you're using an app-specific password rather than your account password.",
"credentials_stored_encrypted": "Your credentials will be stored and encrypted.",
"it_stored_encrypted": "It will be stored and encrypted.",
"go_to_app_store": "Go to App Store",
Expand Down Expand Up @@ -2321,4 +2322,4 @@
"lock_org_users_eventtypes":"Lock individual event type creation",
"lock_org_users_eventtypes_description":"Prevent members from creating their own event types.",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Add your new strings above here ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
}
4 changes: 2 additions & 2 deletions packages/app-store/applecalendar/api/add.ts
Expand Up @@ -44,8 +44,8 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
data,
});
} catch (reason) {
logger.error("Could not add this caldav account", reason);
return res.status(500).json({ message: "Could not add this caldav account" });
logger.error("Could not add this apple calendar account", reason);
return res.status(500).json({ message: "unable_to_add_apple_calendar" });
}

return res
Expand Down
30 changes: 17 additions & 13 deletions packages/app-store/applecalendar/pages/setup/index.tsx
Expand Up @@ -51,19 +51,23 @@ export default function AppleCalendarSetup() {
<Form
form={form}
handleSubmit={async (values) => {
setErrorMessage("");
const res = await fetch("/api/integrations/applecalendar/add", {
method: "POST",
body: JSON.stringify(values),
headers: {
"Content-Type": "application/json",
},
});
const json = await res.json();
if (!res.ok) {
setErrorMessage(json?.message || t("something_went_wrong"));
} else {
router.push(json.url);
try {
setErrorMessage("");
const res = await fetch("/api/integrations/applecalendar/add", {
method: "POST",
body: JSON.stringify(values),
headers: {
"Content-Type": "application/json",
},
});
const json = await res.json();
if (!res.ok) {
setErrorMessage(t(json?.message) || t("something_went_wrong"));
} else {
router.push(json.url);
}
} catch (err) {
setErrorMessage(t("unable_to_add_apple_calendar"));
}
}}>
<fieldset
Expand Down