Add custom hooks for time distance and retrieving like count

Documentation added to all custom hooks
This commit is contained in:
Aaron William Po
2023-04-03 23:32:32 -04:00
parent 801a3c8ad3
commit a4362a531c
13 changed files with 174 additions and 53 deletions

View File

@@ -2,6 +2,15 @@ import GetUserSchema from '@/services/User/schema/GetUserSchema';
import APIResponseValidationSchema from '@/validation/APIResponseValidationSchema';
import useSWR from 'swr';
/**
* A custom React hook that fetches the current user's data from the server.
*
* @returns An object containing the current user's data, a boolean indicating if the
* request is currently loading, and an error object if an error occurred during the
* request.
* @throws When the user is not logged in, the server returns an error status code, or if
* the response data fails to validate against the expected schema.
*/
const useUser = () => {
const {
data: user,