generated from theodorusclarence/ts-nextjs-tailwind-starter
-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
0df9ed9
commit 0957d43
Showing
5 changed files
with
75 additions
and
38 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,22 @@ | ||
'use client'; | ||
import { createSlice, PayloadAction } from '@reduxjs/toolkit'; | ||
|
||
import { createSlice } from '@reduxjs/toolkit'; | ||
interface LoginState { | ||
isLoggedIn: boolean; | ||
} | ||
|
||
const initialState: LoginState = { | ||
isLoggedIn: false, | ||
}; | ||
|
||
export const loginSlice = createSlice({ | ||
name: 'login', | ||
initialState: { | ||
value: false, | ||
}, | ||
initialState, | ||
reducers: { | ||
login: (state) => { | ||
state.value = true; | ||
}, | ||
logout: (state) => { | ||
state.value = false; | ||
setLogin: (state, action: PayloadAction<boolean>) => { | ||
state.isLoggedIn = action.payload; | ||
}, | ||
}, | ||
}); | ||
export const { login, logout } = loginSlice.actions; | ||
|
||
export const { setLogin } = loginSlice.actions; | ||
export default loginSlice.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
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