Get inserted ID after useCreate runs
Refine + Supabase
After I run useCreate(), the record inserts, but I am getting no data in the response. I would like to get the id of the record just created. After a pile of research I discovered if I add the config below to my supabaseClient, the response is as expected with the results of the insert returned in the data object.
I feel as if I am missing something here. I am jumping in the deep end leaning lots of new frameworks all at the same time; so I might be doing something very non-standard or thinking something wrong. My take on this is that there must be a significantly easer way to get the id after useCreate is run.
export const supabaseClient = createClient(SUPABASE_URL, SUPABASE_KEY, {
db: {
schema: "public",
},
auth: {
persistSession: true,
},
global: {
headers: {
Prefer: 'return=representation',
},
}
});
After I run useCreate(), the record inserts, but I am getting no data in the response. I would like to get the id of the record just created. After a pile of research I discovered if I add the config below to my supabaseClient, the response is as expected with the results of the insert returned in the data object.
I feel as if I am missing something here. I am jumping in the deep end leaning lots of new frameworks all at the same time; so I might be doing something very non-standard or thinking something wrong. My take on this is that there must be a significantly easer way to get the id after useCreate is run.
export const supabaseClient = createClient(SUPABASE_URL, SUPABASE_KEY, {
db: {
schema: "public",
},
auth: {
persistSession: true,
},
global: {
headers: {
Prefer: 'return=representation',
},
}
});
