call user-plans api if token present
This commit is contained in:
parent
484464b3ee
commit
1fe2a97f8c
|
@ -16,10 +16,22 @@ enum PaymentActionType {
|
||||||
|
|
||||||
class billingService {
|
class billingService {
|
||||||
public async getPlans(): Promise<Plan[]> {
|
public async getPlans(): Promise<Plan[]> {
|
||||||
|
const token = getToken();
|
||||||
try {
|
try {
|
||||||
const response = await HTTPService.get(
|
let response;
|
||||||
`${ENDPOINT}/billing/plans/v2`
|
if (!token) {
|
||||||
);
|
response = await HTTPService.get(
|
||||||
|
`${ENDPOINT}/billing/plans/v2`
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
response = await HTTPService.get(
|
||||||
|
`${ENDPOINT}/billing/user-plans/v2`,
|
||||||
|
null,
|
||||||
|
{
|
||||||
|
'X-Auth-Token': getToken(),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
const { plans } = response.data;
|
const { plans } = response.data;
|
||||||
return plans;
|
return plans;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
Loading…
Reference in a new issue