mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-07-24 23:39:37 +02:00
fix: Update URL path for user stats counts and remove email from response
This commit is contained in:
parent
3c9aec4bfb
commit
4759ff71a1
2 changed files with 3 additions and 3 deletions
|
@ -14,13 +14,13 @@ class StatsViewSet(viewsets.ViewSet):
|
||||||
"""
|
"""
|
||||||
A simple ViewSet for listing the stats of a user.
|
A simple ViewSet for listing the stats of a user.
|
||||||
"""
|
"""
|
||||||
@action(detail=False, methods=['get'], url_path='counts/(?P<username>[^/.]+)')
|
@action(detail=False, methods=['get'], url_path='counts/(?P<username>[\w.@+-]+)')
|
||||||
def counts(self, request, username):
|
def counts(self, request, username):
|
||||||
if request.user.username == username:
|
if request.user.username == username:
|
||||||
user = get_object_or_404(User, username=username)
|
user = get_object_or_404(User, username=username)
|
||||||
else:
|
else:
|
||||||
user = get_object_or_404(User, username=username, public_profile=True)
|
user = get_object_or_404(User, username=username, public_profile=True)
|
||||||
serializer = PublicUserSerializer(user)
|
# serializer = PublicUserSerializer(user)
|
||||||
|
|
||||||
# remove the email address from the response
|
# remove the email address from the response
|
||||||
user.email = None
|
user.email = None
|
||||||
|
|
|
@ -21,7 +21,7 @@ export const load = (async (event) => {
|
||||||
let stats = null;
|
let stats = null;
|
||||||
|
|
||||||
let res = await event.fetch(
|
let res = await event.fetch(
|
||||||
`${serverEndpoint}/api/stats/counts/${event.locals.user.username}`,
|
`${serverEndpoint}/api/stats/counts/${event.locals.user.username}/`,
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
Cookie: `sessionid=${event.cookies.get('sessionid')}`
|
Cookie: `sessionid=${event.cookies.get('sessionid')}`
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue