moved func to utils
This commit is contained in:
@@ -5,6 +5,7 @@ import { ThemeButton, ThemeText } from '../common/ThemeTypes';
|
||||
import { Picker } from '@react-native-picker/picker';
|
||||
import { FontAwesome } from '@expo/vector-icons';
|
||||
import { Colors } from 'react-native/Libraries/NewAppScreen';
|
||||
import { getDefaultFilter } from '../utils/getDefaultFilter';
|
||||
|
||||
const categories = { class: 'Klasse', room: 'Raum', teacher: 'Lehrer' };
|
||||
|
||||
@@ -143,12 +144,4 @@ return (
|
||||
);
|
||||
};
|
||||
|
||||
const getDefaultFilter = (userInformation) => {
|
||||
if (!userInformation) return null;
|
||||
let type = userInformation.usertype == 'pupil' ? 'class' : 'teacher';
|
||||
let value = userInformation.usertype == 'pupil' ? userInformation.classid : userInformation.id;
|
||||
return { type: type, value: value, group: String(userInformation.group) };
|
||||
};
|
||||
|
||||
|
||||
export default FilterModal;
|
||||
|
||||
@@ -13,6 +13,7 @@ import { ThemeButton, ThemeText } from '../common/ThemeTypes';
|
||||
import { useColors } from '../common/colors';
|
||||
import { AntDesign } from '@expo/vector-icons';
|
||||
import FilterModal from '../common/FilterModal';
|
||||
import { getDefaultFilter } from '../utils/getDefaultFilter';
|
||||
|
||||
let errorObject;
|
||||
let categories = { class: 'Klasse', room: 'Raum', teacher: 'Lehrer' };
|
||||
@@ -124,10 +125,3 @@ const Schedule = () => {
|
||||
};
|
||||
|
||||
export default Schedule;
|
||||
|
||||
const getDefaultFilter = (userInformation) => {
|
||||
if (!userInformation) return null
|
||||
let type = userInformation.usertype == 'pupil' ? 'class' : 'teacher';
|
||||
let value = userInformation.usertype == 'pupil' ? userInformation.classid : userInformation.id;
|
||||
return { type: type, value: value, group: String(userInformation.group) }
|
||||
}
|
||||
6
utils/getDefaultFilter.ts
Normal file
6
utils/getDefaultFilter.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export const getDefaultFilter = (userInformation) => {
|
||||
if (!userInformation) return null;
|
||||
let type = userInformation.usertype == 'pupil' ? 'class' : 'teacher';
|
||||
let value = userInformation.usertype == 'pupil' ? userInformation.classid : userInformation.id;
|
||||
return { type: type, value: value, group: String(userInformation.group) };
|
||||
};
|
||||
Reference in New Issue
Block a user