Skip to content

Commit

Permalink
Added typing for User object in getReminderPrefs
Browse files Browse the repository at this point in the history
notifScheduler.ts
- Added a User interface that acts as a structure instead of using any for the type
  • Loading branch information
sebastianbarry committed Nov 7, 2023
1 parent 6b9d222 commit 97571ee
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions www/js/splash/notifScheduler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,15 @@ const initReminderPrefs = (reminderSchemes) => {
// reminder_time_of_day: string;
// }

export const getReminderPrefs = async (reminderSchemes): Promise<any> => {
const user = (await getUser()) as any;
interface User {
reminder_assignment: string;
reminder_join_date: string;
reminder_time_of_day: string;
}

export const getReminderPrefs = async (reminderSchemes): Promise<User> => {
const userPromise = getUser();
const user = (await userPromise) as User;
if (user?.reminder_assignment && user?.reminder_join_date && user?.reminder_time_of_day) {
console.log('User already has reminder prefs, returning them', user);
return user;
Expand Down

0 comments on commit 97571ee

Please sign in to comment.