File tree 5 files changed +7
-7
lines changed
backend/src/main/java/com/mdgspace/activityleaderboard/controllers
5 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -188,6 +188,11 @@ public ResponseEntity<?> updateProject(@Valid @RequestBody AddProjectRequest upd
188
188
return ResponseEntity .badRequest ().body ("User is not the admin or manager of the org" );
189
189
}
190
190
191
+ Boolean isValidLink =githubService .isValidLink (addProjectRequest .getLink (),user .getAccesstoken ());
192
+ if (!isValidLink ){
193
+ return ResponseEntity .badRequest ().body ("Invalid link provided by the user" );
194
+ }
195
+
191
196
project .setName (updateProjectRequest .getName ());
192
197
project .setDescription (updateProjectRequest .getDescription ());
193
198
project .setLink (updateProjectRequest .getLink ());
Original file line number Diff line number Diff line change @@ -19,7 +19,6 @@ const AddProject = () => {
19
19
const token = localStorage . getItem ( 'token' ) ;
20
20
const { spaceName } = useParams ( ) ;
21
21
const [ orgProject , setOrgProjects ] = useState < Projects | null > ( null ) ;
22
-
23
22
const isUnique = ( name : string ) => {
24
23
if ( orgProject && name in orgProject ) {
25
24
return false ;
@@ -107,22 +106,20 @@ const AddProject = () => {
107
106
updatedForm . description = ' ' ;
108
107
}
109
108
const res = await addProject ( token , spaceName , updatedForm ) ;
110
- // console.log(res);
111
109
// TODO: Update some stuff if the link is case sensitive
112
110
navigate ( `/workspace/${ spaceName } ` ) ;
113
111
} ;
114
112
toast . promise ( func ( ) , {
115
113
loading : 'Saving Project' ,
116
114
success : < b > Project saved</ b > ,
117
- error : < b > Could not save </ b > ,
115
+ error : < b > Invalid link </ b > ,
118
116
} ) ;
119
117
} else {
120
118
toast . error ( 'Invalid inputs' ) ;
121
119
}
122
120
} else {
123
121
toast . error ( 'Form contains errors' ) ;
124
122
}
125
- console . log ( 'sanas' ) ;
126
123
} ;
127
124
128
125
const fetchData = async ( ) => {
Original file line number Diff line number Diff line change @@ -57,7 +57,6 @@ const AddWorkspace = () => {
57
57
) {
58
58
setForm ( { ...form , members : [ ...form . members , form . member ] } ) ;
59
59
setForm ( { ...form , member : '' } ) ;
60
- console . log ( form ) ;
61
60
}
62
61
}
63
62
} ;
Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ const EditProject = () => {
88
88
toast . promise ( func ( ) , {
89
89
loading : 'Saving Project' ,
90
90
success : < b > Project saved</ b > ,
91
- error : < b > Could not save </ b > ,
91
+ error : < b > Invalid link </ b > ,
92
92
} ) ;
93
93
} else {
94
94
toast . error ( 'Invalid inputs' ) ;
Original file line number Diff line number Diff line change @@ -67,7 +67,6 @@ const Workspace = () => {
67
67
} ;
68
68
69
69
const fetchData = async ( ) => {
70
- console . log ( userContext ?. username ) ;
71
70
if ( token && userContext ?. username ) {
72
71
try {
73
72
const userOrgsRes = await getUserOrgs (
You can’t perform that action at this time.
0 commit comments