-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Shuaige1234567
committed
Dec 13, 2023
1 parent
a140b96
commit d2338ff
Showing
10 changed files
with
111 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from "./AllData" | ||
export * from "./profile" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import {createSlice} from "@reduxjs/toolkit" | ||
import {RootState} from "../store" | ||
import {useAppSelector} from "../hook" | ||
import {Profile} from "../../declarations/user/user" | ||
|
||
|
||
const initialState = {} | ||
export const profileSlice = createSlice({ | ||
name: "profile", | ||
initialState, | ||
reducers: { | ||
update: (state, action: { type: string, payload: Profile }) => { | ||
return action.payload | ||
}, | ||
}, | ||
}) | ||
|
||
const {update} = profileSlice.actions | ||
const profile = (state: RootState) => state.profile | ||
export const updateProfile = async (result: Profile) => { | ||
const store = await (await import("../store")).default | ||
store.dispatch(update(result)) | ||
} | ||
export const useProfileStore = (): Profile => useAppSelector(profile) | ||
export default profileSlice.reducer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.