call user-plans api if token present
This commit is contained in:
parent
484464b3ee
commit
1fe2a97f8c
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue