hjryj
Browse files
backend/api/sources.py
CHANGED
@@ -119,9 +119,10 @@ def add_source():
|
|
119 |
)
|
120 |
|
121 |
if response.data:
|
|
|
122 |
return jsonify({
|
123 |
'success': True,
|
124 |
-
'
|
125 |
}), 201
|
126 |
else:
|
127 |
raise Exception("Failed to store source in database")
|
|
|
119 |
)
|
120 |
|
121 |
if response.data:
|
122 |
+
# Return the newly created source data
|
123 |
return jsonify({
|
124 |
'success': True,
|
125 |
+
'source': response.data[0] # Return the first (and should be only) created source
|
126 |
}), 201
|
127 |
else:
|
128 |
raise Exception("Failed to store source in database")
|
frontend/src/store/reducers/sourcesSlice.js
CHANGED
@@ -77,7 +77,7 @@ const sourcesSlice = createSlice({
|
|
77 |
.addCase(addSource.fulfilled, (state, action) => {
|
78 |
state.loading = false;
|
79 |
// Add the new source to the list
|
80 |
-
// The payload
|
81 |
if (action.payload && action.payload.source) {
|
82 |
state.items = [...state.items, action.payload.source];
|
83 |
}
|
|
|
77 |
.addCase(addSource.fulfilled, (state, action) => {
|
78 |
state.loading = false;
|
79 |
// Add the new source to the list
|
80 |
+
// The payload now contains the full source object
|
81 |
if (action.payload && action.payload.source) {
|
82 |
state.items = [...state.items, action.payload.source];
|
83 |
}
|