mirror of
https://github.com/grafana/grafana.git
synced 2025-02-12 16:45:43 -06:00
* Admin: Keeps expired keys visible in table after delete * Chore: covers component in tests before refactor * Refactor: splitting up into smaller components * Chore: fixes a small issue with the validation * Chore: forgot to export type
31 lines
735 B
TypeScript
31 lines
735 B
TypeScript
import { createSlice } from '@reduxjs/toolkit';
|
|
|
|
import { ApiKeysState } from 'app/types';
|
|
|
|
export const initialApiKeysState: ApiKeysState = {
|
|
keys: [],
|
|
searchQuery: '',
|
|
hasFetched: false,
|
|
};
|
|
|
|
const apiKeysSlice = createSlice({
|
|
name: 'apiKeys',
|
|
initialState: initialApiKeysState,
|
|
reducers: {
|
|
apiKeysLoaded: (state, action): ApiKeysState => {
|
|
return { ...state, hasFetched: true, keys: action.payload };
|
|
},
|
|
setSearchQuery: (state, action): ApiKeysState => {
|
|
return { ...state, searchQuery: action.payload };
|
|
},
|
|
},
|
|
});
|
|
|
|
export const { setSearchQuery, apiKeysLoaded } = apiKeysSlice.actions;
|
|
|
|
export const apiKeysReducer = apiKeysSlice.reducer;
|
|
|
|
export default {
|
|
apiKeys: apiKeysReducer,
|
|
};
|