Methods
formatActivity(data) → {Array}
Formats the user's activity data, replacing the date by by the number of the day
Parameters:
| Name | Type | Description |
|---|---|---|
data |
object | user's activity data |
- Source:
Returns:
- Type
- Array
Example
replace 2020-07-01 by 1
Input :
sessions: [
{
day: '2020-07-01',
kilogram: 80,
calories: 240
}
...
]
Output :
sessions: [
{
day: '1',
kilogram: 80,
calories: 240
}
...
]
formatPerf(data) → {Array}
Format the user's performance data, replace the category number with the category
Parameters:
| Name | Type | Description |
|---|---|---|
data |
object | user's performance data |
- Source:
Returns:
- Type
- Array
Example
replace 1 by Cardio
Input :
data: [
{
value: 80,
kind: 1
},
...
]
Output :
data: [
{
value: 80,
kind: 'Cardio'
},
...
]
formatSession(data) → {Array}
Formats the user's session data, replacing the day number with the first letter of the day
Parameters:
| Name | Type | Description |
|---|---|---|
data |
object | user's sessions data |
- Source:
Returns:
- Type
- Array
Example
replace 1 by L for 'Lundi' (Monday in English)
Input :
sessions: [
{
day: 1,
sessionLength: 30
},
...
]
Output :
sessions: [
{
day: 'L',
sessionLength: 30
},
...
]
useUserActivity(id) → {object}
Hook to get User Activity
Parameters:
| Name | Type | Description |
|---|---|---|
id |
number | user ID |
- Source:
Returns:
- Return {data, isLoading, error} to manage the state of the hook
- Type
- object
useUserInfos(id) → {object}
Hook to get User Infos
Parameters:
| Name | Type | Description |
|---|---|---|
id |
number | user ID |
- Source:
Returns:
- Return {data, isLoading, error} to manage the state of the hook
- Type
- object
useUserPerf(id) → {object}
Hook to get User Performance
Parameters:
| Name | Type | Description |
|---|---|---|
id |
number | user ID |
- Source:
Returns:
- Return {data, isLoading, error} to manage the state of the hook
- Type
- object
useUserSessions(id) → {object}
Hook to get User Sessions
Parameters:
| Name | Type | Description |
|---|---|---|
id |
number | user ID |
- Source:
Returns:
- Return {data, isLoading, error} to manage the state of the hook
- Type
- object