💻 Sync with local
This commit is contained in:
parent
636b8561a7
commit
4794d1d83c
File diff suppressed because it is too large
Load Diff
|
@ -42,7 +42,8 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@microsoft/signalr": "^5.0.0",
|
"@microsoft/signalr": "^5.0.0",
|
||||||
"axios": "^0.21.0"
|
"axios": "^0.21.0",
|
||||||
|
"rxjs": "^6.6.3"
|
||||||
},
|
},
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/vexico/spookvooper-api/issues"
|
"url": "https://github.com/vexico/spookvooper-api/issues"
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
// SpookVooper API - modules/TransactionHub.ts
|
||||||
|
// Written by Brendan Lane - https://brndnln.dev/
|
||||||
|
|
||||||
|
// import { Observable } from 'rxjs'
|
||||||
|
import { HubConnectionBuilder, LogLevel } from '@microsoft/signalr'
|
||||||
|
import { ReturnedTransaction } from './interfaces/Interfaces'
|
||||||
|
|
||||||
|
const URI = 'https://spookvooper.com/transactionHub'
|
||||||
|
|
||||||
|
class TransactionHub {
|
||||||
|
private readonly connection = new HubConnectionBuilder()
|
||||||
|
.withUrl(URI)
|
||||||
|
.withAutomaticReconnect()
|
||||||
|
.configureLogging(LogLevel.Information)
|
||||||
|
.build()
|
||||||
|
|
||||||
|
public event
|
||||||
|
|
||||||
|
private val: ReturnedTransaction
|
||||||
|
|
||||||
|
public fromAccount: string
|
||||||
|
public toAccount: string
|
||||||
|
|
||||||
|
constructor () {
|
||||||
|
this.connection.on('NotifyTransaction', (recieved: string) => {
|
||||||
|
this.val = JSON.parse(recieved)
|
||||||
|
this.fromAccount = this.val.FromAccount
|
||||||
|
this.toAccount = this.val.ToAccount
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default TransactionHub
|
|
@ -76,6 +76,20 @@ interface ReturnedUser {
|
||||||
image_Url: string | null
|
image_Url: string | null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface ReturnedTransaction {
|
||||||
|
FromAccount: string
|
||||||
|
ToAccount: string
|
||||||
|
Amount: number
|
||||||
|
Detail: string
|
||||||
|
Force: boolean
|
||||||
|
IsCompleted: boolean
|
||||||
|
Tax: number
|
||||||
|
Result: {
|
||||||
|
Info: string
|
||||||
|
Succeeded: boolean
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
// API Entities
|
// API Entities
|
||||||
EntityUser,
|
EntityUser,
|
||||||
|
@ -85,5 +99,6 @@ export {
|
||||||
ConfigUser,
|
ConfigUser,
|
||||||
ConfigAuth,
|
ConfigAuth,
|
||||||
// API Return Values
|
// API Return Values
|
||||||
ReturnedUser
|
ReturnedUser,
|
||||||
|
ReturnedTransaction
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue