From a63d4bef07a049d4784370ca9845363b68d3e1c4 Mon Sep 17 00:00:00 2001 From: Andrea Magnussen <andrea@magnussen.net> Date: Tue, 15 Jun 2021 12:54:15 +0200 Subject: [PATCH] Added documentation to app and APIkit --- APIkit.js | 9 ++++++++- App.js | 16 ++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/APIkit.js b/APIkit.js index 740b4ab..a99c700 100644 --- a/APIkit.js +++ b/APIkit.js @@ -1,6 +1,13 @@ import axios from "axios"; -// Create axios client, pre-configured with baseURL +/** + * An instance of axios which is used everytime a network request is needed. + * @baseURL where the request should be sent to. + * @timeout how long the system will try to perform the request. + * @headers what type of data is accepted. + * + * @return the instance. + */ let APIKit = axios.create({ baseURL: "http://192.168.0.30:5000", timeout: 60000, diff --git a/App.js b/App.js index c23ec43..9739e73 100644 --- a/App.js +++ b/App.js @@ -9,10 +9,26 @@ import theme from "./assets/themes/Theme"; import RootStackScreen from "./navigation/RootStackScreen"; import Toast from "react-native-toast-message"; +/** + * The application. + * + * @store - used for redux and the state store. + * @theme - used for theming and the look of the application (react native paper) + * @authContext - the first way of handling the state of the user. Still in use to switch the stack based on the users + * log in state. Should be replaced by redux. + * @userToken - used for handling the user state. + * @Toast - used for the toast messages to be visible on all screens when used. + * + * @returns the application. + */ export default function App() { const [isLoading, setIsLoading] = React.useState(true); const [userToken, setUserToken] = React.useState(null); + /** + * An early version of handling state in the application, to see if a user is logged in or not. + * Should be replaced by redux in the future. + */ const authContext = React.useMemo(() => { return { signInApp: () => { -- GitLab