File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
packages/samples/sudt/src/services Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ export class ExplorerService {
2+ constructor ( private host = '' ) { }
3+
4+ updateSUDT = async ( params : {
5+ typeHash : string
6+ symbol : string
7+ fullName : string
8+ decimal : string
9+ totalAmount : string
10+ description : string
11+ operatorWebsite : string
12+ iconFile : string
13+ uan : string
14+ displayName : string
15+ email : string
16+ token ?: string
17+ } ) => {
18+ const res = await fetch ( `${ this . host } /api/v1/udts/${ params . typeHash } ` , { method : 'POST' , body : JSON . stringify ( { } ) } )
19+ if ( ! res . ok ) {
20+ throw new Error ( 'Internal Service Error' )
21+ }
22+
23+ switch ( Math . ceil ( res . status / 100 ) ) {
24+ case 2 :
25+ return true
26+ case 3 :
27+ throw new Error ( 'Redirect' )
28+ case 4 :
29+ throw new Error ( 'Client Error' )
30+ }
31+ }
32+ }
You can’t perform that action at this time.
0 commit comments