Skip to content

Commit

Permalink
2766 fix settings (#435)
Browse files Browse the repository at this point in the history
* Change account type detection

* Return empty array for settings on error
  • Loading branch information
sutherlanda authored Feb 21, 2020
1 parent 9ad29c9 commit e207aeb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions auth-api/src/auth_api/resources/user_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""API endpoints for managing a User resource."""
import json

from flask import g
from flask_restplus import Namespace, Resource, cors
Expand Down Expand Up @@ -54,11 +55,11 @@ def get(user_id):
try:
user = UserService.find_by_jwt_token(token)
if not user:
response, status = {'message': 'User not found.'}, http_status.HTTP_404_NOT_FOUND
response, status = json.dumps([]), http_status.HTTP_200_OK
else:
all_settings = UserSettingsService.fetch_user_settings(user.identifier)
response, status = UserSettingsSchema(many=True).dumps(all_settings), http_status.HTTP_200_OK

except BusinessException as exception:
response, status = {'code': exception.code, 'message': exception.message}, exception.status_code
except BusinessException:
response, status = json.dumps([]), http_status.HTTP_200_OK
return response, status

0 comments on commit e207aeb

Please sign in to comment.