call user-plans api if token present

This commit is contained in:
Abhinav 2022-01-14 17:41:33 +05:30
parent 484464b3ee
commit 1fe2a97f8c

View file

@ -16,10 +16,22 @@ enum PaymentActionType {
class billingService {
public async getPlans(): Promise<Plan[]> {
const token = getToken();
try {
const response = await HTTPService.get(
let response;
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;
return plans;
} catch (e) {