2020-11-09 15:17:38 +01:00
|
|
|
import apiClient from './api-client';
|
|
|
|
import { AxiosResponse } from 'axios';
|
2020-11-24 16:26:18 +01:00
|
|
|
import { CustomAsset, CustomAssetName } from '../models/custom-asset';
|
2020-11-09 15:17:38 +01:00
|
|
|
import wrapPromise, { IWrapPromise } from '../lib/wrap-promise';
|
|
|
|
|
|
|
|
export default class CustomAssetAPI {
|
2020-11-24 16:26:18 +01:00
|
|
|
async get (name: CustomAssetName): Promise<CustomAsset> {
|
2020-11-09 15:17:38 +01:00
|
|
|
const res: AxiosResponse = await apiClient.get(`/api/custom_assets/${name}`);
|
|
|
|
return res?.data?.custom_asset;
|
|
|
|
}
|
|
|
|
|
2020-11-24 16:26:18 +01:00
|
|
|
static get (name: CustomAssetName): IWrapPromise<CustomAsset> {
|
2020-11-09 15:17:38 +01:00
|
|
|
const api = new CustomAssetAPI();
|
|
|
|
return wrapPromise(api.get(name));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|