Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
Breeze
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DeStream-public
Breeze
Commits
3fa0b4c1
Commit
3fa0b4c1
authored
8 years ago
by
dev0tion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move error handling to frontend
parent
fea31959
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
28 deletions
+8
-28
api.service.ts
Breeze.UI/src/app/shared/api/api.service.ts
+8
-28
No files found.
Breeze.UI/src/app/shared/api/api.service.ts
View file @
3fa0b4c1
...
...
@@ -27,7 +27,7 @@ export class ApiService {
createWallet
(
data
:
WalletCreation
):
Observable
<
any
>
{
return
this
.
http
.
post
(
this
.
webApiUrl
+
'/wallet/create/'
,
JSON
.
stringify
(
data
),
{
headers
:
this
.
headers
})
.
map
(
response
=>
response
.
json
()
);
.
map
(
(
response
:
Response
)
=>
response
);
}
/**
...
...
@@ -36,7 +36,7 @@ export class ApiService {
recoverWallet
(
data
:
WalletRecovery
):
Observable
<
any
>
{
return
this
.
http
.
post
(
this
.
webApiUrl
+
'/wallet/recover/'
,
JSON
.
stringify
(
data
),
{
headers
:
this
.
headers
})
.
map
(
response
=>
response
.
json
()
);
.
map
(
(
response
:
Response
)
=>
response
);
}
/**
...
...
@@ -45,8 +45,7 @@ export class ApiService {
loadWallet
(
data
:
WalletLoad
):
Observable
<
any
>
{
return
this
.
http
.
get
(
this
.
webApiUrl
+
'/wallet/load/'
,
{
headers
:
this
.
headers
,
body
:
JSON
.
stringify
(
data
)})
.
map
(
response
=>
response
.
json
())
.
catch
(
this
.
handleError
);
.
map
((
response
:
Response
)
=>
response
);
}
/**
...
...
@@ -55,8 +54,7 @@ export class ApiService {
getWalletStatus
():
Observable
<
any
>
{
return
this
.
http
.
get
(
this
.
mockApiUrl
+
'/wallet/status'
)
.
map
((
response
:
Response
)
=>
response
.
json
())
.
catch
(
this
.
handleError
);
.
map
((
response
:
Response
)
=>
response
);
}
/**
...
...
@@ -65,8 +63,7 @@ export class ApiService {
getWalletBalance
():
Observable
<
any
>
{
return
this
.
http
.
get
(
this
.
webApiUrl
+
'/wallet/balance'
)
.
map
((
response
:
Response
)
=>
response
.
json
())
.
catch
(
this
.
handleError
);
.
map
((
response
:
Response
)
=>
response
);
}
/**
...
...
@@ -75,8 +72,7 @@ export class ApiService {
getWalletHistory
():
Observable
<
any
>
{
return
this
.
http
.
get
(
this
.
webApiUrl
+
'/wallet/history'
)
.
map
((
response
:
Response
)
=>
response
.
json
())
.
catch
(
this
.
handleError
);
.
map
((
response
:
Response
)
=>
response
);
}
/**
...
...
@@ -85,24 +81,8 @@ export class ApiService {
getUnusedReceiveAddresses
():
Observable
<
any
>
{
return
this
.
http
.
get
(
this
.
webApiUrl
+
'/wallet/receive'
)
.
map
((
response
:
Response
)
=>
response
.
json
())
.
catch
(
this
.
handleError
);
.
map
((
response
:
Response
)
=>
response
);
}
/**
* Handle errors from the API.
* @param error
*/
private
handleError
(
error
:
Response
|
any
)
{
let
errMsg
:
string
;
if
(
error
instanceof
Response
)
{
const
body
=
error
.
json
()
||
''
;
const
err
=
body
.
error
||
JSON
.
stringify
(
body
);
errMsg
=
`
${
error
.
status
}
-
${
error
.
statusText
||
''
}
${
err
}
`
;
}
else
{
errMsg
=
error
.
message
?
error
.
message
:
error
.
toString
();
}
console
.
error
(
errMsg
);
return
Observable
.
throw
(
errMsg
);
}
}
This diff is collapsed.
Click to expand it.
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