first commit

This commit is contained in:
rohit-kumar-fullstack
2026-01-02 17:56:16 +05:30
parent b94f98a764
commit 59fb7e0df4
149 changed files with 9362 additions and 12549 deletions
+20
View File
@@ -0,0 +1,20 @@
import { createSlice } from '@reduxjs/toolkit';
const initialState = {
auction: '',
};
export const auctionSlice = createSlice({
name: 'auction',
initialState,
reducers: {
setAuction: (state, { payload }) => {
state.auction = payload;
},
removeAuction: (state) => {
state.auction = '';
}
},
});
export const { setAuction , removeAuction} = auctionSlice.actions;
export default auctionSlice.reducer;
+20
View File
@@ -0,0 +1,20 @@
import { createSlice } from '@reduxjs/toolkit';
const initialState = {
token: '',
};
export const tokenSlice = createSlice({
name: 'token',
initialState,
reducers: {
setToken: (state, { payload }) => {
state.token = payload;
},
removeToken: (state) => {
state.token = '';
}
},
});
export const { setToken , removeToken} = tokenSlice.actions;
export default tokenSlice.reducer;
@@ -0,0 +1,39 @@
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
export interface AuctionItem {
auctionNumber: string;
[key: string]: any;
}
// ✅ DEFAULT = EMPTY ARRAY
const initialState: AuctionItem[] = [];
export const selectPurchaseAuctionSlice = createSlice({
name: 'selectPurchaseAuction',
initialState,
reducers: {
togglePurchaseAuction: (
state,
action: PayloadAction<AuctionItem>
) => {
const index = state.findIndex(
item => item.auctionNumber === action.payload.auctionNumber
);
if (index !== -1) {
state.splice(index, 1);
} else {
state.push(action.payload);
}
},
clearPurchaseAuction: () => [],
},
});
export const {
togglePurchaseAuction,
clearPurchaseAuction,
} = selectPurchaseAuctionSlice.actions;
export default selectPurchaseAuctionSlice.reducer;
+27
View File
@@ -0,0 +1,27 @@
import {configureStore} from '@reduxjs/toolkit';
import {combineReducers} from 'redux';
import {persistStore, persistReducer} from 'redux-persist';
import AsyncStorage from '@react-native-async-storage/async-storage';
import {tokenSlice} from './Slices/Token';
import {auctionSlice} from './Slices/SelectedAuction';
import selectPurchaseAuctionReducer from './Slices/selectPurchaseAuction'
const rootReducer = combineReducers({
token: tokenSlice.reducer,
auction: auctionSlice.reducer,
selectPurchaseAuction: selectPurchaseAuctionReducer,
});
const persistConfig = {
key: 'root',
storage: AsyncStorage,
whitelist: ['token'],
};
const persistReducers = persistReducer(persistConfig, rootReducer);
export const store = configureStore({
reducer: persistReducers,
middleware: getDefaultMiddleware =>
getDefaultMiddleware({
serializableCheck: false,
}),
});
export const persistor = persistStore(store);