Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
N
Neos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Biluo Shen
Neos
Commits
f77b0872
Commit
f77b0872
authored
Nov 26, 2022
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove cardsSlice
parent
f848ccdf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
49 deletions
+0
-49
src/reducers/cardsSlice.ts
src/reducers/cardsSlice.ts
+0
-47
src/store.ts
src/store.ts
+0
-2
No files found.
src/reducers/cardsSlice.ts
deleted
100644 → 0
View file @
f848ccdf
/*
* 卡牌数据存储
*
* */
import
{
createSlice
,
createAsyncThunk
}
from
"
@reduxjs/toolkit
"
;
import
{
CardMeta
,
fetchCard
}
from
"
../api/cards
"
;
import
{
RootState
}
from
"
../store
"
;
export
const
fetchCardMetaById
=
createAsyncThunk
(
"
cards/fetchByIdStatus
"
,
async
(
cardId
:
number
)
=>
{
return
await
fetchCard
(
cardId
);
}
);
export
interface
Card
{
meta
?:
CardMeta
;
state
:
string
;
}
export
interface
CardMetaState
{
metas
:
Map
<
number
,
Card
>
;
}
const
initialState
:
CardMetaState
=
{
metas
:
new
Map
(),
};
const
cardsSlice
=
createSlice
({
name
:
"
cards
"
,
initialState
,
reducers
:
{},
extraReducers
:
(
builder
)
=>
{
builder
.
addCase
(
fetchCardMetaById
.
fulfilled
,
(
state
,
action
)
=>
{
const
id
=
action
.
payload
.
id
;
const
card
=
{
meta
:
action
.
payload
,
state
:
"
filled
"
,
};
state
.
metas
.
set
(
id
,
card
);
});
// TODO: handle pending and rejected
},
});
export
const
selectCards
=
(
state
:
RootState
)
=>
state
.
cards
.
metas
;
export
default
cardsSlice
.
reducer
;
src/store.ts
View file @
f77b0872
...
@@ -7,7 +7,6 @@ import chatReducer from "./reducers/chatSlice";
...
@@ -7,7 +7,6 @@ import chatReducer from "./reducers/chatSlice";
import
playerReducer
from
"
./reducers/playerSlice
"
;
import
playerReducer
from
"
./reducers/playerSlice
"
;
import
moraReducer
from
"
./reducers/moraSlice
"
;
import
moraReducer
from
"
./reducers/moraSlice
"
;
import
duelReducer
from
"
./reducers/duel/mod
"
;
import
duelReducer
from
"
./reducers/duel/mod
"
;
import
cardsReducer
from
"
./reducers/cardsSlice
"
;
export
const
store
=
configureStore
({
export
const
store
=
configureStore
({
reducer
:
{
reducer
:
{
...
@@ -16,7 +15,6 @@ export const store = configureStore({
...
@@ -16,7 +15,6 @@ export const store = configureStore({
player
:
playerReducer
,
player
:
playerReducer
,
mora
:
moraReducer
,
mora
:
moraReducer
,
duel
:
duelReducer
,
duel
:
duelReducer
,
cards
:
cardsReducer
,
},
},
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment