Skip to content

Commit 674e4d7

Browse files
committed
fix linting issues and use consistent axios methods
1 parent 5e0ea9a commit 674e4d7

File tree

6 files changed

+18
-19
lines changed

6 files changed

+18
-19
lines changed

src/components/popups/DonatePopup.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ export default function DonatePopup() {
4949
const { enableDonator } = useFeatureStore();
5050

5151
const initializePaymentSheet = async () => {
52-
const response = await axios(`${getBackendUrl()}/stripe/payment-sheet`, {
52+
const response = await axios.request({
53+
url: `${getBackendUrl()}/stripe/payment-sheet`,
5354
method: "POST",
5455
data: {
5556
amount: Number.parseFloat(amount),

src/components/popups/UpdatePopup.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default function UpdatePopup() {
1919

2020
React.useEffect(() => {
2121
const checkUpdate = async () => {
22-
const res = await axios({
22+
const res = await axios.request({
2323
url: "https://api.github.com/repos/vshopapp/mobile/releases/latest",
2424
method: "GET",
2525
});

src/screens/Shop.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Countdown from "../components/Countdown";
55
import { useUserStore } from "../stores/user";
66

77
export default function ShopScreen() {
8-
const user = useUserStore(({ user }) => user);
8+
const user = useUserStore((state) => state.user);
99
const timestamp = new Date().getTime() + user.shops.remainingSecs.main * 1000;
1010

1111
return (

src/typings/StorefrontV3.d.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import type { VCurrencies } from "../utils/misc";
2-
31
export interface IStorefrontV3 {
42
FeaturedBundle: FeaturedBundle;
53
SkinsPanelLayout: SkinsPanelLayout;

src/utils/VShopAPI.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export const getBackendUrl = () => {
77

88
export const checkDonator = async (riotId: string) => {
99
try {
10-
const res = await axios({
10+
const res = await axios.request({
1111
url: `${getBackendUrl()}/user/${riotId}`,
1212
method: "GET",
1313
timeout: 5 * 1000,
@@ -21,7 +21,7 @@ export const checkDonator = async (riotId: string) => {
2121
};
2222

2323
export const getCurrencies = async () => {
24-
const res = await axios({
24+
const res = await axios.request({
2525
url: `${getBackendUrl()}/stripe/currencies`,
2626
method: "GET",
2727
});

src/utils/ValorantAPI.ts

+12-12
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const extraHeaders = {
5757

5858
export async function loadVersion() {
5959
try {
60-
const res = await axios({
60+
const res = await axios.request({
6161
url: "https://valorant-api.com/v1/version",
6262
method: "GET",
6363
});
@@ -69,7 +69,7 @@ export async function loadVersion() {
6969
}
7070

7171
export async function loadSkins() {
72-
const res2 = await axios({
72+
const res2 = await axios.request({
7373
url: `https://valorant-api.com/v1/weapons/skins?language=${getVAPILang()}`,
7474
method: "GET",
7575
});
@@ -78,7 +78,7 @@ export async function loadSkins() {
7878
}
7979

8080
export async function getEntitlementsToken(accessToken: string) {
81-
const res = await axios({
81+
const res = await axios.request({
8282
url: getUrl("entitlements"),
8383
method: "POST",
8484
headers: {
@@ -104,7 +104,7 @@ export async function getUsername(
104104
userId: string,
105105
region: string,
106106
) {
107-
const res = await axios({
107+
const res = await axios.request({
108108
url: getUrl("name", region),
109109
method: "PUT",
110110
headers: {
@@ -124,7 +124,7 @@ export async function loadOffers(
124124
entitlementsToken: string,
125125
region: string,
126126
) {
127-
const res = await axios({
127+
const res = await axios.request({
128128
url: getUrl("offers", region),
129129
method: "GET",
130130
headers: {
@@ -167,7 +167,7 @@ export async function parseShop(shop: IStorefrontV3) {
167167
let main: IShopItem[] = [];
168168
for (var i = 0; i < singleItemOffers.length; i++) {
169169
const skin = skins.find(
170-
(skin) => skin.levels[0].uuid == singleItemOffers[i],
170+
(_skin) => _skin.levels[0].uuid == singleItemOffers[i],
171171
) as ISkin;
172172

173173
main[i] = {
@@ -183,7 +183,7 @@ export async function parseShop(shop: IStorefrontV3) {
183183

184184
bundles[i] = {
185185
...(
186-
await axios({
186+
await axios.request({
187187
url: `https://valorant-api.com/v1/bundles/${
188188
bundle.DataAssetID
189189
}?language=${getVAPILang()}`,
@@ -197,7 +197,7 @@ export async function parseShop(shop: IStorefrontV3) {
197197
(item: any) => item.Item.ItemTypeID === VItemTypes.SkinLevel,
198198
).map((item: any) => {
199199
const skin = skins.find(
200-
(skin) => skin.levels[0].uuid === item.Item.ItemID,
200+
(_skin) => _skin.levels[0].uuid === item.Item.ItemID,
201201
) as ISkin;
202202

203203
return {
@@ -215,7 +215,7 @@ export async function parseShop(shop: IStorefrontV3) {
215215
for (var i = 0; i < bonusStore.length; i++) {
216216
let itemid = bonusStore[i].Offer.Rewards[0].ItemID;
217217
const skin = skins.find(
218-
(skin) => skin.levels[0].uuid === itemid,
218+
(_skin) => _skin.levels[0].uuid === itemid,
219219
) as ISkin;
220220

221221
nightMarket[i] = {
@@ -248,7 +248,7 @@ export async function getBalances(
248248
region: string,
249249
userId: string,
250250
) {
251-
const res = await axios({
251+
const res = await axios.request({
252252
url: getUrl("wallet", region, userId),
253253
method: "GET",
254254
headers: {
@@ -271,7 +271,7 @@ export async function getProgress(
271271
region: string,
272272
userId: string,
273273
) {
274-
const res = await axios({
274+
const res = await axios.request({
275275
url: getUrl("playerxp", region, userId),
276276
method: "GET",
277277
headers: {
@@ -288,7 +288,7 @@ export async function getProgress(
288288
}
289289

290290
export const reAuth = () =>
291-
axios({
291+
axios.request({
292292
url: "https://auth.riotgames.com/api/v1/authorization",
293293
method: "POST",
294294
headers: {

0 commit comments

Comments
 (0)