import { createAsyncThunk } from "@reduxjs/toolkit";
import axios from "axios";
import { getActualRoleFromRole } from "../../../utils/getRoleFromUrl";

export const changeBankForm = createAsyncThunk(
  "CHANGE_BANK_FORM",
  async (d) => {
    const role = window.location.pathname.split("/")[3];
    const { data, status } = await axios.post(
      `user-bank_card/?role=${getActualRoleFromRole(role)}`,
      d
    );
    return { data, status };
  }
);
