You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
677 B
38 lines
677 B
import {
|
|
DATA_URL,
|
|
PROCEDURES,
|
|
} from 'config'
|
|
import { callApi } from 'helpers'
|
|
|
|
const proc = PROCEDURES.save_user_subscription
|
|
|
|
type Response = {
|
|
_p_error: string | null,
|
|
_p_status: 1 | 2,
|
|
}
|
|
|
|
const responseStatus = {
|
|
FAILURE: 2,
|
|
SUCCESS: 1,
|
|
}
|
|
|
|
export const saveUserSubscription = async (subscriptionId : number | null) => {
|
|
const config = {
|
|
body: {
|
|
params: {
|
|
_p_subscription_id: subscriptionId,
|
|
},
|
|
proc,
|
|
},
|
|
}
|
|
|
|
const response: Response = await callApi({
|
|
config,
|
|
url: DATA_URL,
|
|
})
|
|
|
|
if (response._p_status === responseStatus.SUCCESS) {
|
|
return Promise.resolve()
|
|
}
|
|
return Promise.reject(response._p_error)
|
|
}
|
|
|