File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ const ArchitectsPage = () => {
7878 const fileExt = file . name . split ( "." ) . pop ( ) ;
7979 const fileName = `${ user . id } _${ Date . now ( ) } .${ fileExt } ` ;
8080
81- const { data , error : uploadError } = await supabase . storage
81+ const { error : uploadError } = await supabase . storage
8282 . from ( "Architects" )
8383 . upload ( fileName , file , {
8484 cacheControl : "3600" ,
@@ -106,7 +106,7 @@ const ArchitectsPage = () => {
106106 }
107107 } ;
108108
109- // ✅ Handle form submit with duplicate prevention
109+ // ✅ Handle form submit with duplicate prevention + update role
110110 const handleRegister = async ( e : React . FormEvent ) => {
111111 e . preventDefault ( ) ;
112112
@@ -154,6 +154,14 @@ const ArchitectsPage = () => {
154154
155155 if ( error ) throw error ;
156156
157+ // ✅ Step 3: Update user_role to 'architect' in profiles table
158+ const { error : roleError } = await supabase
159+ . from ( "profiles" )
160+ . update ( { user_role : "architect" } )
161+ . eq ( "id" , user . id ) ;
162+
163+ if ( roleError ) throw roleError ;
164+
157165 setMessage ( "Successfully registered as architect!" ) ;
158166 setFormData ( {
159167 name : "" ,
@@ -408,4 +416,3 @@ const ArchitectsPage = () => {
408416} ;
409417
410418export default ArchitectsPage ;
411-
You can’t perform that action at this time.
0 commit comments