Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions docs/api-probe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# API probe for player match profile

Tried to authenticate and fetch player match profile data using the provided test account:

```
curl -i -H 'Content-Type: application/json' -X POST \
https://ttp-api.codemymobile.com/api/auth/login \
-d '{"email":"player27@thetennisplan.com","password":"tennis123"}'
```

**Result:** The request was blocked by the outbound proxy with `HTTP/1.1 403 Forbidden` ("CONNECT tunnel failed"). No API token could be retrieved, so follow-up GET requests for the match profile could not be executed from this environment.
20 changes: 11 additions & 9 deletions src/api/playerHome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,16 +330,18 @@ export interface FetchPlayerDetailsParams extends PlayerTokenOnlyParams {
userId: number | string;
}

export const fetchPlayerDetails = async ({ token, userId }: FetchPlayerDetailsParams) =>
request<Record<string, unknown>>(
"/player/surveys/getchecklocation/specific_user",
{
token,
query: {
userId,
},
const formatUserIdQuery = (userId: number | string) => String(userId).trim();

export const fetchPlayerDetails = async ({ token, userId }: FetchPlayerDetailsParams) => {
const formattedUserId = formatUserIdQuery(userId);

return request<Record<string, unknown>>("/player/surveys/getchecklocation/specific_user", {
token,
query: {
userId: formattedUserId,
},
);
});
};

export interface SuggestedPlayerCheckLocationParams extends PaginationParams {
token: string;
Expand Down
16 changes: 16 additions & 0 deletions src/api/playerProfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,27 @@ export interface PlayerProfile {
[key: string]: unknown;
}

export interface PlayerPersonalDetails {
id?: number;
full_name?: string;
email?: string;
phone?: string;
profile_picture?: string;
about_me?: string;
gender?: string;
[key: string]: unknown;
}

export const getPlayerDetails = async (token: string) =>
request<PlayerProfile>("/player/profile", {
token,
});

export const getPlayerPersonalDetails = async (token: string) =>
request<PlayerPersonalDetails>("/player/personal_details", {
token,
});

export interface OtherPlayerDetailsParams {
token: string;
userId: number | string;
Expand Down
Loading