Update form to look better & add automatic lunch toggle
This commit is contained in:
@@ -34,7 +34,7 @@ export const getUser = query(async (ctx) => {
|
||||
name: user.name ?? null,
|
||||
image,
|
||||
lunchTime: user.lunchTime ?? null,
|
||||
automaticLunch: user.automaticLunch ?? false as boolean,
|
||||
automaticLunch: user.automaticLunch ?? (false as boolean),
|
||||
};
|
||||
});
|
||||
|
||||
@@ -46,7 +46,7 @@ export const getAllUsers = query(async (ctx) => {
|
||||
name: u.name ?? null,
|
||||
image: u.image ?? null,
|
||||
lunchTime: u.lunchTime ?? null,
|
||||
automaticLUnch: u.automaticLunch ?? false as boolean,
|
||||
automaticLUnch: u.automaticLunch ?? (false as boolean),
|
||||
}));
|
||||
});
|
||||
|
||||
@@ -123,12 +123,11 @@ export const updateUserAutomaticLunch = mutation({
|
||||
if (!userId) throw new ConvexError('Not authenticated.');
|
||||
const user = await ctx.db.get(userId);
|
||||
if (!user) throw new ConvexError('User not found.');
|
||||
if (user.automaticLunch === automaticLunch)
|
||||
return { success: true };
|
||||
if (user.automaticLunch === automaticLunch) return { success: true };
|
||||
await ctx.db.patch(userId, { automaticLunch });
|
||||
return { success: true };
|
||||
},
|
||||
})
|
||||
});
|
||||
|
||||
export const validatePassword = (password: string): boolean => {
|
||||
if (
|
||||
|
Reference in New Issue
Block a user