Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
ReactNativeBase
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nguyen Danh Khanh
ReactNativeBase
Commits
33db63cc
Commit
33db63cc
authored
Jul 05, 2021
by
Nguyen Danh Khanh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixApi
parent
4ab396ac
Pipeline
#156
failed with stages
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
34 deletions
+6
-34
src/api/config.ts
src/api/config.ts
+2
-2
src/api/listProduct.ts
src/api/listProduct.ts
+3
-1
src/redux/reducers/auth.ts
src/redux/reducers/auth.ts
+1
-31
No files found.
src/api/config.ts
View file @
33db63cc
import
axios
from
'
axios
'
;
import
config
from
'
../configs
'
;
import
store
from
"
../redux/store
"
;
import
{
store
}
from
"
../redux/store
"
;
const
apiLogRequest
=
(
apiName
:
any
,
axiosRequest
:
any
)
=>
{
console
.
group
&&
...
...
@@ -58,7 +58,7 @@ const client = axios.create({
client
.
interceptors
.
request
.
use
(
request
=>
{
const
token
=
store
.
getState
().
auth
.
token
;
const
token
=
store
.
getState
().
auth
request
.
headers
.
Authorization
=
token
;
return
request
;
}
...
...
src/api/listProduct.ts
View file @
33db63cc
...
...
@@ -2,7 +2,9 @@ import axios from 'axios'
import
config
from
'
../configs
'
import
{
store
}
from
'
../redux/store
'
export
function
*
getListProducts
()
{
const
token
=
store
.
getState
().
auth
.
token
export
function
getListProducts
()
{
const
body
=
{
"
drug_barcode
"
:
""
,
...
...
src/redux/reducers/auth.ts
View file @
33db63cc
...
...
@@ -18,36 +18,6 @@ const initialState : InitStateAuth = {
token
:
null
}
// const auth = createSlice({
// name: 'auth',
// initialState,
// reducers: {
// loginSuccess(state, action) {
// state.token = action.payload.token
// }
// }
// })
// const { loginSuccess } = auth.actions
interface
CounterState
{
username
:
string
password
:
string
token
:
string
|
null
}
// const authReducer = (state = initialState, action: AnyAction) => {
// const { type, payload } = action;
// switch (type) {
// case Types.LOGIN: {
// return {
// ...state,
// isLogin: payload,
// };
// }
// default:
// return state;
// }
// }
function
productReducer
(
state
=
initialState
,
action
:
ActionType
)
{
const
payload
=
action
.
payload
...
...
@@ -55,7 +25,7 @@ function productReducer(state = initialState, action: ActionType) {
case
'
LOGIN_SUCCESS
'
:
return
{
...
state
,
token
:
payload
,
auth
:
payload
,
};
default
:
return
state
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment