diff --git a/backend/artistsmgmt/__pycache__/views.cpython-310.pyc b/backend/artistsmgmt/__pycache__/views.cpython-310.pyc index 2a55689..0d119d6 100644 Binary files a/backend/artistsmgmt/__pycache__/views.cpython-310.pyc and b/backend/artistsmgmt/__pycache__/views.cpython-310.pyc differ diff --git a/backend/artistsmgmt/views.py b/backend/artistsmgmt/views.py index 93df14b..c57b256 100644 --- a/backend/artistsmgmt/views.py +++ b/backend/artistsmgmt/views.py @@ -68,12 +68,19 @@ def post(self, request, format=None): # return self.request.user -class ArtistOnlyView(APIView): +# class ArtistOnlyView(APIView): +# permission_classes = [IsAuthenticated, IsArtist] +# serializer_class = UserSerializer + +# def get(self, request, format=None): +# return Response(data={"message": "You are an artist"}, status=status.HTTP_200_OK) + +class ArtistOnlyView(generics.RetrieveAPIView): permission_classes = [IsAuthenticated, IsArtist] serializer_class = UserSerializer - def get(self, request, format=None): - return Response(data={"message": "You are an artist"}, status=status.HTTP_200_OK) + def get_object(self): + return self.request.user class ArtistCreateView(generics.ListCreateAPIView): diff --git a/frontend/src/pages/homepage.js b/frontend/src/pages/homepage.js index 5419a93..a569503 100644 --- a/frontend/src/pages/homepage.js +++ b/frontend/src/pages/homepage.js @@ -49,8 +49,7 @@ const HomePage = () => {
{userData ? (
-

{userData.message}!

- {/* Display user-specific content */} +

Welcome, {userData.username}!

) : (

Loading...

diff --git a/frontend/src/pages/signup.js b/frontend/src/pages/signup.js index 90e82ab..f52a50d 100644 --- a/frontend/src/pages/signup.js +++ b/frontend/src/pages/signup.js @@ -57,8 +57,11 @@ const SignUpForm = () => { } } catch (error) { console.error("Error during signup:", error); - setErrorMessage("Error during signup. Please try again."); - setSuccessMessage(""); + if (error.response && error.response.status === 400) { + setErrorMessage("A user with that username already exists."); + } else { + setErrorMessage("Signup failed. Please try again."); + } } };