Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
ecommerce-maven
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ascend
ecommerce-maven
Commits
ec576b16
Commit
ec576b16
authored
May 11, 2021
by
Christopher Cottier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added backend api url to config, uses in api_util files
parent
38e8a2c7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
6 deletions
+8
-6
config.js
ecom-web/src/config.js
+2
-2
product_api_util.js
ecom-web/src/util/product_api_util.js
+4
-3
session-api-util.js
ecom-web/src/util/session-api-util.js
+2
-1
No files found.
ecom-web/src/config.js
View file @
ec576b16
class
Config
{
static
baseApiUrl
=
"http://localhost:8080
/api
"
;
//env file
static
orderHistoryApiUrlMethod
=
(
userId
)
=>
`
${
this
.
baseApiUrl
}
/orders/byUser/
${
userId
}
`
;
static
baseApiUrl
=
"http://localhost:8080"
;
//env file
static
orderHistoryApiUrlMethod
=
(
userId
)
=>
`
${
this
.
baseApiUrl
}
/
api/
orders/byUser/
${
userId
}
`
;
}
...
...
ecom-web/src/util/product_api_util.js
View file @
ec576b16
import
axios
from
'axios'
;
import
Config
from
'../config'
;
export
const
fetchProducts
=
()
=>
{
return
axios
.
get
(
"http://localhost:8080/api/products"
)
return
axios
.
get
(
`
${
Config
.
baseApiUrl
}
/api/products`
)
}
export
const
fetchPromotions
=
()
=>
{
return
axios
.
get
(
"http://localhost:8080/api/promos"
)
return
axios
.
get
(
`
${
Config
.
baseApiUrl
}
/api/promos`
)
}
export
const
fetchProductsAndPromotions
=
()
=>
{
return
axios
.
get
(
"http://localhost:8080/api/products-and-promos"
)
return
axios
.
get
(
`
${
Config
.
baseApiUrl
}
/api/products-and-promos`
)
}
\ No newline at end of file
ecom-web/src/util/session-api-util.js
View file @
ec576b16
import
axios
from
'axios'
;
import
Config
from
'../config'
;
export
const
postUser
=
(
user
)
=>
{
return
axios
.
post
(
"http://localhost:8080/api/users"
,
user
)
return
axios
.
post
(
`
${
Config
.
baseApiUrl
}
/api/users`
,
user
)
}
// export const postUser = (user) => {
...
...
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