Skip to content

Commit

Permalink
fix(redux): asyncthunkreducer removed
Browse files Browse the repository at this point in the history
  • Loading branch information
juunie-roh committed Aug 13, 2024
1 parent 718a7fd commit 1d7f391
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 137 deletions.
29 changes: 1 addition & 28 deletions src/app/techrecord/(pages)/redux-example/page.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
'use client';

import { decrement, getCatFacts, increment } from '@/libs/features';
import { decrement, increment } from '@/libs/features';
import { useAppDispatch, useAppSelector } from '@/libs/hooks';
import type { CatFact } from '@/types';

import styles from './page.module.css';

export default function ReduxExample() {
const count = useAppSelector((state) => state.counter.data);
const catFacts = useAppSelector((state) => state.catFacts.data);
const dispatch = useAppDispatch();

return (
Expand All @@ -23,31 +21,6 @@ export default function ReduxExample() {
Increase
</button>
</div>
<h2 className={styles.title}>API Example (Cat Facts)</h2>
<div>
<button type="button" onClick={() => dispatch(getCatFacts())}>
Get Cat Facts
</button>
<div>
{catFacts &&
catFacts.map((catFact: CatFact) => (
<div key={catFact._id}>
<span>---------------------------</span>
<p>
status: [ verified: {catFact.status.verified}, sentCount:{' '}
{catFact.status.sentCount} ]
</p>
<p>
type: {catFact.type}, id: {catFact._id}
</p>
<p>text: {catFact.text}</p>
<p>created date: {catFact.createdAt}</p>
<p>updated date: {catFact.updatedAt}</p>
<p>user: {catFact.user}</p>
</div>
))}
</div>
</div>
</>
);
}
76 changes: 0 additions & 76 deletions src/libs/api/AsyncReducers.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/libs/api/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export * from './AsyncReducers';
export * from './AsyncThunk';
24 changes: 0 additions & 24 deletions src/libs/features/catFacts/catFactsSlice.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/libs/features/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from './apiSlice';
export * from './auth/authSlice';
export * from './catFacts/catFactsSlice';
export * from './counter/counterSlice';
8 changes: 1 addition & 7 deletions src/libs/store.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
import { configureStore } from '@reduxjs/toolkit';

import {
apiSlice,
authReducer,
catFactsReducer,
counterReducer,
} from '@/libs/features';
import { apiSlice, authReducer, counterReducer } from '@/libs/features';

export const makeStore = () => {
return configureStore({
reducer: {
counter: counterReducer,
catFacts: catFactsReducer,
auth: authReducer,
[apiSlice.reducerPath]: apiSlice.reducer,
},
Expand Down

0 comments on commit 1d7f391

Please sign in to comment.