Commit 976b3997 by Arjun Jhukal

replaced balance with available at withdrawl

parent 87a34838
...@@ -231,6 +231,7 @@ export default function PlayerListing() { ...@@ -231,6 +231,7 @@ export default function PlayerListing() {
try { try {
const res = await downloadUser({ const res = await downloadUser({
search, search,
status: currentTab
}).unwrap(); }).unwrap();
const blob = new Blob([res], { type: "text/csv" }); const blob = new Blob([res], { type: "text/csv" });
......
...@@ -195,6 +195,7 @@ export default function TransactionTable({ user_id, game_id, search, setSearch } ...@@ -195,6 +195,7 @@ export default function TransactionTable({ user_id, game_id, search, setSearch }
user: user_id?.toString(), user: user_id?.toString(),
game: game_id?.toString(), game: game_id?.toString(),
search, search,
status
}).unwrap(); }).unwrap();
const blob = new Blob([res], { type: "text/csv" }); const blob = new Blob([res], { type: "text/csv" });
......
...@@ -136,7 +136,7 @@ export default function WithdrawlPage({ ...@@ -136,7 +136,7 @@ export default function WithdrawlPage({
.map((game) => { .map((game) => {
const info = const info =
gameInfo[game.provider.toLowerCase()] || { gameInfo[game.provider.toLowerCase()] || {
balance: 0, available: 0,
type: "sc", type: "sc",
}; };
...@@ -166,7 +166,7 @@ export default function WithdrawlPage({ ...@@ -166,7 +166,7 @@ export default function WithdrawlPage({
{game?.name} {game?.name}
</strong> </strong>
<span className="text-[12px] font-[600]"> <span className="text-[12px] font-[600]">
{info.balance} {info.available}
</span> </span>
</div> </div>
</div> </div>
...@@ -214,7 +214,7 @@ export default function WithdrawlPage({ ...@@ -214,7 +214,7 @@ export default function WithdrawlPage({
onClick={() => onClick={() =>
handleWithdrawlChange( handleWithdrawlChange(
game.provider, game.provider,
info.balance.toString() info.available.toString()
) )
} }
type="button" type="button"
......
...@@ -34,12 +34,13 @@ export const downloadApi = createApi({ ...@@ -34,12 +34,13 @@ export const downloadApi = createApi({
baseQuery: baseQuery, baseQuery: baseQuery,
tagTypes: ["Download"], tagTypes: ["Download"],
endpoints: (builder) => ({ endpoints: (builder) => ({
downloadTransaction: builder.mutation<Blob, { user?: string; game?: string; search?: string }>({ downloadTransaction: builder.mutation<Blob, { user?: string; game?: string; search?: string; status?: string }>({
async queryFn(args, _queryApi, _extraOptions, fetchWithBQ) { async queryFn(args, _queryApi, _extraOptions, fetchWithBQ) {
const params = new URLSearchParams(); const params = new URLSearchParams();
if (args.user) params.append("user", args.user.toString()); if (args.user) params.append("user", args.user.toString());
if (args.game) params.append("game", args.game.toString()); if (args.game) params.append("game", args.game.toString());
if (args.search) params.append("search", args.search.toString()); if (args.search) params.append("search", args.search.toString());
if (args.status) params.append("status", args.status.toString());
const queryString = params.toString(); const queryString = params.toString();
const response = await fetchWithBQ({ const response = await fetchWithBQ({
...@@ -52,10 +53,11 @@ export const downloadApi = createApi({ ...@@ -52,10 +53,11 @@ export const downloadApi = createApi({
return { data: response.data as Blob }; return { data: response.data as Blob };
}, },
}), }),
downloadUser: builder.mutation<Blob, { search?: string }>({ downloadUser: builder.mutation<Blob, { search?: string; status?: string }>({
async queryFn(args, _queryApi, _extraOptions, fetchWithBQ) { async queryFn(args, _queryApi, _extraOptions, fetchWithBQ) {
const params = new URLSearchParams(); const params = new URLSearchParams();
if (args.search) params.append("search", args.search.toString()); if (args.search) params.append("search", args.search.toString());
if (args.status) params.append("status", args.status.toString());
const queryString = params.toString(); const queryString = params.toString();
const response = await fetchWithBQ({ const response = await fetchWithBQ({
...@@ -71,4 +73,4 @@ export const downloadApi = createApi({ ...@@ -71,4 +73,4 @@ export const downloadApi = createApi({
}), }),
}); });
export const { useDownloadTransactionMutation,useDownloadUserMutation } = downloadApi; export const { useDownloadTransactionMutation, useDownloadUserMutation } = downloadApi;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment