27 lines
794 B
TypeScript
27 lines
794 B
TypeScript
import { getWalletTransactions, initializeWalletTopUpApi, TopupPayload } from '@api';
|
|
import { createAsyncThunk } from '@reduxjs/toolkit';
|
|
|
|
export const getAllWalletTransactions = createAsyncThunk(
|
|
'wallet/getAllWalletTransactions',
|
|
async (_, { rejectWithValue }) => {
|
|
try {
|
|
const response = await getWalletTransactions();
|
|
return response;
|
|
} catch (error: any) {
|
|
return rejectWithValue(error.response.data);
|
|
}
|
|
},
|
|
);
|
|
|
|
export const initializeWalletTopUpThunk = createAsyncThunk(
|
|
'wallet/initializeWalletTopUp',
|
|
async (payload: TopupPayload, { rejectWithValue }) => {
|
|
try {
|
|
const response = await initializeWalletTopUpApi(payload);
|
|
return response;
|
|
} catch (error: any) {
|
|
return rejectWithValue(error.response.data);
|
|
}
|
|
},
|
|
);
|