Skip to content

Commit

Permalink
Added temporary handling for local storage exception
Browse files Browse the repository at this point in the history
  • Loading branch information
Suraj-Ram committed Feb 6, 2024
1 parent 9d4a86d commit acc958a
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions packages/frontend/components/Plan/DuplicatePlanButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,19 @@ export const DuplicatePlanButton: React.FC<DuplicatePlanButton> = ({
updatedAt: new Date(),
} as PlanModel<null>;

// TODO handle QuotaExceededError exception
window.localStorage.setItem(
"student",
JSON.stringify({
...student,
plans: [...student.plans, planLocalStorage],
})
);
// TODO handle QuotaExceededError exception better
try {
window.localStorage.setItem(
"student",
JSON.stringify({
...student,
plans: [...student.plans, planLocalStorage],
})
);
} catch (error) {
toast.error("Maximum local storage quota exceed. Too many plans.");
return;
}
} else {
try {
const createdPlan = await API.plans.create(updatedPlan);
Expand Down

0 comments on commit acc958a

Please sign in to comment.