Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2022-196
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
2022-196
2022-196
Commits
012d2b04
Commit
012d2b04
authored
Nov 15, 2022
by
Dilip Wijethunga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Service file update
parent
c3c907c0
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
88 additions
and
1 deletion
+88
-1
frontend/src/services/CoinService.jsx
frontend/src/services/CoinService.jsx
+12
-0
frontend/src/services/CommonAuthCheck.jsx
frontend/src/services/CommonAuthCheck.jsx
+16
-0
frontend/src/services/CurrencyService.jsx
frontend/src/services/CurrencyService.jsx
+4
-0
frontend/src/services/UserService.jsx
frontend/src/services/UserService.jsx
+55
-0
frontend/src/services/connection.json
frontend/src/services/connection.json
+1
-1
No files found.
frontend/src/services/CoinService.jsx
0 → 100644
View file @
012d2b04
import
Connection
from
"
./connection.json
"
import
axios
from
"
axios
"
;
const
FLASK_API
=
Connection
.
localAddress
+
'
/api/csv/
'
;
class
CoinService
{
getSavedDataCSVByCoinName
(
coin
)
{
return
axios
.
get
(
FLASK_API
+
coin
,
{
responseType
:
'
blob
'
})
}
}
export
default
new
CoinService
();
frontend/src/services/CommonAuthCheck.jsx
0 → 100644
View file @
012d2b04
import
React
from
"
react
"
;
import
{
Redirect
}
from
'
react-router-dom
'
;
import
UserService
from
"
./UserService
"
;
const
CommonCheckAuth
=
(
Component
)
=>
{
const
AuthRoute
=
()
=>
{
const
isAuth
=
!!
UserService
.
getCurrentUser
();
if
(
isAuth
)
{
return
<
Component
/>;
}
else
{
return
<
Redirect
to=
"/Login"
/>;
}
};
return
AuthRoute
;
};
export
default
CommonCheckAuth
;
\ No newline at end of file
frontend/src/services/CurrencyService.jsx
View file @
012d2b04
...
...
@@ -20,6 +20,10 @@ class CurrencyService {
getPredictionByCurrencyAction
(
currency
,
action
)
{
return
axios
.
get
(
FLASK_API
+
'
/predict/
'
+
currency
+
'
/
'
+
action
)
}
getSentiment
(){
return
axios
.
get
(
FLASK_API
+
'
/sentiment
'
)
}
}
export
default
new
CurrencyService
();
frontend/src/services/UserService.jsx
0 → 100644
View file @
012d2b04
import
axios
from
"
axios
"
;
import
Connection
from
"
./connection.json
"
const
FLASK_API
=
Connection
.
localAddress
+
'
/auth/
'
;
class
UserService
{
// User login
login
(
username
,
password
){
return
axios
.
post
(
FLASK_API
+
"
signin
"
,
{
username
,
password
}).
then
(
response
=>
{
if
(
response
.
data
){
if
(
response
.
message
===
"
Unsuccessful
"
)
{
console
.
log
(
"
Unsuccessful
"
);
}
else
{
sessionStorage
.
setItem
(
"
user
"
,
JSON
.
stringify
(
response
.
data
));
}
}
return
response
.
data
;
});
}
// User register
register
(
full_name
,
email
,
username
,
password
,
role
,
image
){
return
axios
.
post
(
FLASK_API
+
"
signup
"
,
{
full_name
,
username
,
email
,
password
,
role
,
image
});
}
// Get current user
getCurrentUser
()
{
return
JSON
.
parse
(
sessionStorage
.
getItem
(
'
user
'
));
}
//Remove current user
logout
()
{
sessionStorage
.
removeItem
(
"
user
"
);
sessionStorage
.
clear
();
window
.
location
.
href
=
"
/
"
;
}
getAllUsers
()
{
return
axios
.
get
(
Connection
.
localAddress
+
'
/user
'
);
}
}
export
default
new
UserService
();
\ No newline at end of file
frontend/src/services/connection.json
View file @
012d2b04
{
"localAddress"
:
"http
://127.0.0.1:5000
"
,
"localAddress"
:
"http
s://cfapi-dilipwijethunga.cloud.okteto.net
"
,
"remoteAddress"
:
""
}
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