Toggle navigation
Toggle navigation
This project
Loading...
Sign in
윤창신
/
searchGuide
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-11-25 20:09:02 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c0a6c9d0b80516d4d1d25b0264d81415217f9156
c0a6c9d0
1 parent
61300541
add reducers
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
searchGuide/reducers/search.js
searchGuide/reducers/search.js
View file @
c0a6c9d
...
...
@@ -23,13 +23,14 @@ export const load = () => async (dispatch) =>{
export
const
submit
=
(
text
)
=>
async
(
dispatch
)
=>
{
dispatch
(
{
type
:
START
});
try
{
const
response
=
await
sendSearch
(
text
.
nativeEvent
.
text
);
let
tempScore
=
scoring
(
response
.
return_data
).
full
;
await
sqlite
.
insert
(
tempScore
);
const
response
=
await
readTest
()
//const response = await sendSearch(text.nativeEvent.text);
let
tempScore
=
scoring
(
response
.
return_data
);
await
sqlite
.
insert
(
tempScore
.
full
);
let
past
=
await
sqlite
.
select
();
past
=
past
.
map
(
elem
=>
elem
.
score
);
//dispatch( { type:SUCCESS, result:response }
dispatch
(
{
type
:
SUCCESS
,
result
:
response
,
past
:
past
})
dispatch
(
{
type
:
SUCCESS
,
result
:
response
,
past
:
past
,
score
:
tempScore
})
}
catch
(
err
){
console
.
log
(
err
);
...
...
@@ -51,6 +52,7 @@ const initialState = {
searchResults
:
[]
}
},
score
:
{},
isLoading
:
false
,
pastScore
:
[
10
,
10
,
10
,
10
,
10
,
10
],
};
...
...
@@ -60,7 +62,8 @@ export default ToggleLoading = (state = initialState, action) => {
case
CHANGE
:
return
{...
state
,
query
:
action
.
text
};
case
SUCCESS
:
return
{...
state
,
isLoading
:
false
,
result
:
action
.
result
,
pastScore
:
action
.
past
};
return
{...
state
,
isLoading
:
false
,
score
:
action
.
score
,
result
:
action
.
result
,
pastScore
:
action
.
past
};
case
FAILURE
:
return
{...
state
,
isLoading
:
false
};
case
START
:
...
...
Please
register
or
login
to post a comment