mirror of
https://github.com/mudabbir-ahmad/Project-MAD-crudler.git
synced 2026-10-08 04:40:20 +00:00
Added useLoad function, updated moduleView to include cohort, added useLoad to module list screen and module form, so there is a dropdown now for leaders as well.
This commit is contained in:
1 parent
57369791a4
commit
dd5324ff39
5 files changed
+49
-57
No files matched your search
@@ -1,33 +1,26 @@
|
||||
import {useState, useEffect} from "react";
|
||||
import {LogBox, StyleSheet, Text} from "react-native";
|
||||
// import {useState, useEffect} from "react";
|
||||
import {LogBox, Text} from "react-native";
|
||||
import Screen from "../layout/Screen";
|
||||
import ModuleList from "../entity/modules/ModuleList";
|
||||
import API from "../API/API";
|
||||
// import API from "../API/API";
|
||||
// import initialModules from "../../data/modules.js";
|
||||
// import RenderCount from "../UI/RenderCount";
|
||||
import {Button, ButtonTray} from "../UI/Button";
|
||||
import Icons from "../UI/Icons";
|
||||
import useLoad from "../API/useLoad";
|
||||
|
||||
|
||||
const ModuleListScreen = ({navigation}) => {
|
||||
// Initialisation -------------
|
||||
// let modules = initialModules;
|
||||
LogBox.ignoreLogs(['Non-serializable values were found in the navigation state']);
|
||||
|
||||
|
||||
const modulesEndpoint = 'https://softwarehub.uk/unibase/api/modules';
|
||||
|
||||
|
||||
// State ----------------------
|
||||
const [modules, setModules] = useState([]);
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
|
||||
const loadModules = async (endpoint) => {
|
||||
const response = await API.get(endpoint);
|
||||
setIsLoading(false);
|
||||
if (response.isSuccess) setModules(response.result);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
loadModules(modulesEndpoint)
|
||||
}, []);
|
||||
const [modules, setModules, isLoading, loadModules] = useLoad(modulesEndpoint);
|
||||
|
||||
// Handlers -------------------
|
||||
|
||||
@@ -79,7 +72,7 @@ const ModuleListScreen = ({navigation}) => {
|
||||
);
|
||||
};
|
||||
|
||||
const styles = StyleSheet.create({});
|
||||
// const styles = StyleSheet.create({});
|
||||
|
||||
export default ModuleListScreen;
|
||||
|
||||
|
||||
Reference in new issue
Block a user