justinjunodev
03/11/2022, 8:33 PMsocial
table that includes a row for each user
. Within that row are columns for several social networks (twitter, youtube, twitch, whatever, etc.).
Question: Chances are most users will not have every social network listed, but the form will include inputs for each social column available. That said, is there a specific way I should structure the update query? Or is it standard to submit all the fields and include fallback values with the existing state to catch those that are not in use/ okay as is?
*Example: Is this standard/ okay? *
const { data, error } = await supabase
.from('social')
.update(
{ twitter: newStateValue || prevStateValue},
{ youtube: newStateValue || prevStateValue},
{ twitch: newStateValue || prevStateValue}
)
.eq('user', user.id)
Needle
03/11/2022, 8:33 PM/title
command!
We have solved your problem?
Click the button below to archive it.silentworks
03/12/2022, 10:03 AMNeedle
03/12/2022, 10:03 AM