all commands and buttons are working
This commit is contained in:
@@ -8,15 +8,34 @@ class PlayerService {
|
||||
|
||||
async findUserByUsername(username) {
|
||||
try {
|
||||
const response = await axios.get(
|
||||
`${this.baseUrl}/api/get_player_data_by_username/${encodeURIComponent(username)}`,
|
||||
{
|
||||
timeout: 5000
|
||||
console.log(`Fetching data for username: ${username}`);
|
||||
const url = `${this.baseUrl}/api/get_player_data_by_username/${encodeURIComponent(username)}`;
|
||||
console.log(`API URL: ${url}`);
|
||||
|
||||
const response = await axios.get(url, {
|
||||
timeout: 5000
|
||||
});
|
||||
|
||||
console.log('API Response:', JSON.stringify(response.data, null, 2));
|
||||
|
||||
if (response.data && response.data.success) {
|
||||
// Parse player_data if it's a string
|
||||
if (typeof response.data.player_data === 'string') {
|
||||
try {
|
||||
response.data.player_data = JSON.parse(response.data.player_data);
|
||||
} catch (parseError) {
|
||||
console.error('Error parsing player_data:', parseError);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
console.error('Error fetching user data:', error);
|
||||
console.error('Error fetching user data:', {
|
||||
message: error.message,
|
||||
response: error.response?.data,
|
||||
status: error.response?.status
|
||||
});
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user