(row_id: any)
| 15 | } |
| 16 | |
| 17 | export async function decreaseUserCredits(row_id: any) { |
| 18 | const { data, error } = await supabase.rpc('decrease_credits', { |
| 19 | row_id, |
| 20 | }); |
| 21 | |
| 22 | if (error) { |
| 23 | throw new Error('Error updating user credits'); |
| 24 | } |
| 25 | |
| 26 | return data; |
| 27 | } |
| 28 | |
| 29 | export async function addUserCredits(row_id: any, credit_amount: any) { |
| 30 | const { data, error } = await supabase.rpc('add_credits', { |