PozoAppOptimandSEO/src/features/appMenuAccess/appMenuAccess.js

48 lines
1.5 KiB
JavaScript
Raw Normal View History

import { createAsyncThunk, createSlice } from "@reduxjs/toolkit";
import {axiosInstanceData} from '../AuthenticationTokens/AuthenticationToken';
export const getSadminUser = createAsyncThunk(
"appMenuAccess/getSadminUser",
async () => {
return await axiosInstanceData.get('/login?Type=Super Admin User');
}
);
export const getApplications = createAsyncThunk(
"appMenuAccess/getApplications",
async ({ UserId }) => {
if (UserId != null && UserId != undefined) {
return await axiosInstanceData.get(`/appAccess?UserId=${UserId}`);
}
}
);
export const getMenu = createAsyncThunk(
"appMenuAccess/getMenu",
async ({ AppId }) => {
if (AppId != null && AppId != undefined) {
return await axiosInstanceData.get(`/appMenu?AppId=${AppId}`);
}
}
);
export const getPreviousMenu = createAsyncThunk(
"appMenuAccess/getPreviousMenu",
async ({ AppId, UserId }) => {
if (AppId != null && AppId != undefined && UserId != null && UserId != undefined) {
return await axiosInstanceData.get(`/AppMenuAccess?AppId=${AppId}&UserId=${UserId}`);
}
}
);
export const postAppMenuAccess = createAsyncThunk('appMenuAccess/postAppMenuAccess', async (postData) => {
return await axiosInstanceData.post(`/AppMenuAccess`, postData)
})
export const putAppMenuAccess = createAsyncThunk('appMenuAccess/putAppMenuAccess', async (putData) => {
return await axiosInstanceData.put(`/AppMenuAccess`, putData)
})