Added tweak to announcements and json for url of CMS

This commit is contained in:
M10T 2020-08-13 18:55:10 -04:00
parent 4b14f130cc
commit e663cc9a95
6 changed files with 18 additions and 11 deletions

View File

@ -18,10 +18,15 @@ import {
} from 'react-native/Libraries/NewAppScreen';
import styles from './styles/liststyles'
import { url } from './resources/fetchInfo.json'
const Announcement = ({item}) => {
const date = new Date
const dateStr = `${date.getMonth()+1}/${date.getUTCDate()}/${date.getFullYear()}`
const dateInfo = dateStr===item.item.date&&item.item.time!==undefined?item.item.time:item.item.date;
return (
<View style={styles.item}>
{dateInfo!==undefined?<Text style={styles.date}>{dateInfo}</Text>:<></>}
<Text style={styles.title}>{item.item.message}</Text>
</View>
)
@ -37,7 +42,7 @@ class Announcements extends React.Component {
}
componentDidMount() {
fetch('https://6dc2642ae9b3.ngrok.io/api/en/announcements',{
fetch(`${url}/api/en/announcements`,{
headers: {
'Cache-Control': 'no-cache'
}

View File

@ -1,11 +1,3 @@
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow strict-local
*/
import React from 'react';
import {
SafeAreaView,

View File

@ -20,6 +20,7 @@ import {
} from 'react-native/Libraries/NewAppScreen';
import { SearchBar } from 'react-native-elements';
import styles from './styles/liststyles'
import { url } from './resources/fetchInfo.json'
const ClubElement = ({item}) => {
const [visible, setVisible] = useState(0)
@ -49,7 +50,7 @@ class Clubs extends React.Component {
componentDidMount() {
fetch('https://6dc2642ae9b3.ngrok.io/api/en/clubs',{
fetch(`${url}/api/en/clubs`,{
headers: {
'Cache-Control': 'no-cache'
} })

View File

@ -19,6 +19,7 @@ import {
} from 'react-native/Libraries/NewAppScreen';
import styles from './styles/liststyles'
import { url } from './resources/fetchInfo.json'
const LunchEvent = ({item}) => {
const [visible, setVisible] = useState(0)
@ -43,7 +44,7 @@ class LunchEvents extends React.Component {
}
componentDidMount() {
fetch('https://6dc2642ae9b3.ngrok.io/api/en/lunchEvents',{
fetch(`${url}/api/en/lunchEvents`,{
headers: {
'Cache-Control': 'no-cache'
}

View File

@ -0,0 +1 @@
{"url":"http://10.0.2.2:5000"}

View File

@ -14,6 +14,13 @@ const styles = StyleSheet.create({
title: {
fontSize: 32,
},
date: {
fontSize:12,
marginBottom:'-3%',
alignSelf:'flex-end',
marginTop:'-3%',
marginRight:'-3%'
}
});
export default styles;