Toggle navigation
Toggle navigation
This project
Loading...
Sign in
유희정
/
fwiot
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
유희정
2019-12-18 18:12:19 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
709943ef288a04d3c1b26e7a099d011ae99bfde0
709943ef
1 parent
41e840e0
id수정
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
16 additions
and
10 deletions
App.js
package-lock.json
source/AppTabNavigator/HistoryTab.js
source/AppTabNavigator/HomeTab.js
source/Login.js
source/component/DBhelper.js
App.js
View file @
709943e
...
...
@@ -5,7 +5,7 @@ import { createStackNavigator } from 'react-navigation-stack'
// import MainScreen from './components/MainScreen';
import
Login
from
'./source/Login'
;
import
MainScreen
from
'./source/MainScreen'
;
import
{
getId
}
from
'./source/component/DBhelper'
import
{
checkUser
}
from
'./source/component/DBhelper'
// const AppStackNavigator = createStackNavigator({
// Main:{
...
...
@@ -17,7 +17,7 @@ import {getId} from './source/component/DBhelper'
var
initialName
=
''
if
(
getId
()
==
true
){
if
(
checkUser
()
==
true
){
initialName
=
'MainScreen'
}
else
initialName
=
'Login'
...
...
package-lock.json
View file @
709943e
This diff is collapsed. Click to expand it.
source/AppTabNavigator/HistoryTab.js
View file @
709943e
...
...
@@ -2,7 +2,7 @@ import React, { Component } from 'react';
import
{
View
,
Text
,
StyleSheet
,
ScrollView
,
RefreshControl
}
from
'react-native'
;
import
HistoryGraph
from
'../component/HistoryGraph'
import
SegmentedControlTab
from
"react-native-segmented-control-tab"
;
import
{
add_data
,
get_week_data
,
get_month_data
,
get_year_data
,
add_temp_data
}
from
'../component/DBhelper.js'
;
import
{
get_id
,
add_data
,
get_week_data
,
get_month_data
,
get_year_data
,
add_temp_data
}
from
'../component/DBhelper.js'
;
//var today = new Date();
//today.setHours(today.getHours()+9);
...
...
@@ -22,7 +22,8 @@ export default class HomeTab extends Component {
data
:
get_week_data
(),
title
:
"총 "
+
total
(
get_week_data
())
/
1000
+
"kg"
,
spane
:
""
,
refreshing
:
false
refreshing
:
false
,
ID
:
get_id
(),
}
}
...
...
@@ -67,7 +68,7 @@ export default class HomeTab extends Component {
'Content-Type'
:
'application/json'
,
},
body
:
JSON
.
stringify
({
ras_id
:
"pi1"
,
ras_id
:
this
.
state
.
ID
,
date
:
"1576339901541"
,
}),
})
...
...
source/AppTabNavigator/HomeTab.js
View file @
709943e
...
...
@@ -2,7 +2,7 @@ import React, { Component } from 'react';
import
{
View
,
Text
,
StyleSheet
,
SafeAreaView
,
ScrollView
,
Image
}
from
'react-native'
;
import
Circle
from
'../component/circle_component'
import
{
Table
,
TableWrapper
,
Row
,
Rows
}
from
'react-native-table-component'
import
{
get_now_weight
,
get_today_data
,
add_data
,
add_temp_data
}
from
'../component/DBhelper.js'
;
import
{
get_now_weight
,
get_today_data
,
add_data
,
add_temp_data
,
get_id
}
from
'../component/DBhelper.js'
;
var
date
=
new
Date
();
date
.
setHours
(
date
.
getHours
()
+
9
);
...
...
@@ -15,7 +15,7 @@ export default class HomeTab extends Component {
constructor
(
props
){
super
(
props
);
this
.
state
=
{
ID
:
this
.
props
.
navigation
.
getParam
(
'id'
,
'pi1'
),
ID
:
get_id
(
),
today
:
date
.
getFullYear
()
+
"."
+
month
+
"."
+
date
.
getDate
(),
current_weight
:
get_now_weight
()
,
table_contents
:
get_today_data
()
...
...
@@ -44,7 +44,7 @@ export default class HomeTab extends Component {
'Content-Type'
:
'application/json'
,
},
body
:
JSON
.
stringify
({
ras_id
:
"pi1"
,
ras_id
:
this
.
state
.
ID
,
date
:
"1576648647000"
,
}),
})
...
...
source/Login.js
View file @
709943e
...
...
@@ -16,7 +16,7 @@ export default class Login extends Component {
};
getdata
()
{
return
fetch
(
'http://testloadbalancer-1847561458.ap-northeast-2.elb.amazonaws.com/app/get_data/
pi1'
)
return
fetch
(
'http://testloadbalancer-1847561458.ap-northeast-2.elb.amazonaws.com/app/get_data/
'
+
this
.
state
.
ID
)
.
then
((
response
)
=>
response
.
json
())
.
then
((
responseJson
)
=>
{
add_data
(
responseJson
);
...
...
source/component/DBhelper.js
View file @
709943e
...
...
@@ -28,7 +28,7 @@ export function registerID(_id){
}
}
export
function
getId
(){
export
function
checkUser
(){
let
user
=
realm
.
objects
(
'ID'
);
console
.
log
(
user
.
length
);
if
(
user
.
length
>
0
)
...
...
@@ -36,6 +36,11 @@ export function getId(){
return
false
;
}
export
function
get_id
(){
let
user
=
realm
.
objects
(
'ID'
);
return
user
[
0
].
id
;
}
export
function
deleteId
(){
let
user
=
realm
.
objects
(
'ID'
);
realm
.
write
(()
=>
{
...
...
Please
register
or
login
to post a comment