Account
useGetProfileInfoQuery
This function is used to fetch user profile information.
The useGetProfileInfoQuery function is imported from '@akinon/next/data/client/account'.
import { useGetProfileInfoQuery } from '@akinon/next/data/client/account';This function can be used to access data like the user's name, surname, email, phone number, birth date, birth month, birth year, gender, and more. To use this function, assign it to a variable like this:
const { data: profileInfo } = useGetProfileInfoQuery();Specific data can be accessed by using the profileInfo variable. For example, to access the email:
const userEmail = profileInfo?.email ?? '';The data returned from the function:
{
"id": 7,
"first_name": "FirstName",
"last_name": "LastName",
"email_allowed": false,
"sms_allowed": false,
"call_allowed": null,
"avatar": null,
"email": "[email protected]",
"phone": "05351231212",
"date_of_birth": "2023-04-28",
"gender": "female",
"genders": [
{
"value": "female",
"label": "female"
},
{
"value": "male",
"label": "male"
}
],
"language_code": "en",
"attributes": {
"register_client_type": "default",
"logged_ip": "31.223.57.74",
"confirm": true
}
}useGetContactSubjectsQuery
This function is used to fetch contact form subject titles from Omnitron.
The useGetContactSubjectsQuery function is imported from '@akinon/next/data/client/account'.
To use this function, create a variable and call the function:
The
isLoadingvalue indicates whether the subject data is being loaded. In order to use LoaderSpinner properly, isLoading data can be used.The
isSuccessvalue becomestruewhen the subjects are successfully loaded.
The data returned from the function:
useGetOrderQuery
This function is used to fetch details about a single order.
The useGetOrderQuery function is imported from '@akinon/next/data/client/account'.
To use this function, the order ID needs to be given to the function:
The returned data can be used as {order.status.label}.
Data returned from the function:
useGetOrdersQuery
This function is used to fetch a list of orders belonging to a user.
The useGetOrdersQuery function is imported from '@akinon/next/data/client/account'.
This function can be used like this:
The incoming data can be mapped within orders?.results?. The item from the mapped list can be processed in the component where it is located or can be sent to a card component as shown below and processed there.
The returned data from the function:
useGetCancellationReasonsQuery
This function is used to fetch cancellation reasons for orders from Omnitron.
The useGetCancellationReasonsQuery function is imported from '@akinon/next/data/client/account'.
To get the cancellation reasons, define a variable and call the function:
isSuccessbecomestruewhen the reasons are successfully loaded.
The returned data from the function:
To map the data, a variable called cancelReasons is defined.
cancelReasons now becomes a variable that provides a plain list of the cancellation reasons.
useGetBasketOffersQuery
This function is used to fetch a list of coupons from Omnitron.
The useGetBasketOffersQuery function is imported from '@akinon/next/data/client/account'.
To use this function, create a variable and call the function:
Data returned from the function:
useGetFutureBasketOffersQuery
This function is used to fetch a list of coupons that will be used in the future from Omnitron.
The useGetFutureBasketOffersQuery function is imported from '@akinon/next/data/client/account'.
To use this function, create a variable and call the function:
Data returned from the function:
useGetExpiredBasketOffersQuery
This function is used to fetch a list of expired coupons from Omnitron.
The useGetExpiredBasketOffersQuery function is imported from '@akinon/next/data/client/account'.
To use this function, create a variable and call the function:
Data returned from the function:
useGetDiscountItemsQuery
This function is used to fetch a list of used coupons from Omnitron.
The useGetDiscountItemsQuery function is imported from '@akinon/next/data/client/account'.
To use this function, create a variable and call the function:
Data returned from the function:
useGetLoyaltyBalanceQuery
This function is used to fetch a user's loyalty points balance.
The useGetLoyaltyBalanceQuery function is imported from '@akinon/next/data/client/account'.
To use this function, create a variable and call the function:
useGetLoyaltyTransactionsQuery
This function is used to fetch a list of a user's loyalty transactions, both used and unused points. Negative points in the list represent used points.
The useGetLoyaltyTransactionsQuery function is imported from '@akinon/next/data/client/account'.
To use this function, create a variable and call the function:
const { data: loyalty, isLoading: isLoadingLoyaltyList } = useGetLoyaltyTransactionsQuery();
The variable can be mapped to the location where you desire to display list. An example of how to map the data is provided below:
useGetOldOrdersQuery
This function is used to get the list of past orders of a user.
The useGetOldOrdersQuery function is imported from '@akinon/next/data/client/account'.
This function can be used like this:
The incoming data can be mapped within oldOrders?.results The item from the mapped list can be processed in the component where it is located or can be sent to a card component as shown below and processed there.
Last updated
Was this helpful?

