-
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
fd8161f
commit 198a671
Showing
12 changed files
with
318 additions
and
114 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import {createSlice} from '@reduxjs/toolkit'; | ||
import {RootState} from '../useRedux'; | ||
|
||
const sliceName = 'camera'; | ||
|
||
const slice = createSlice({ | ||
name: sliceName, | ||
initialState: { | ||
label: 'Prompt', | ||
value: 'prompt', | ||
} as CameraState, | ||
reducers: { | ||
changeDefault: (state: CameraState, action: CameraLoad) => { | ||
state.label = | ||
typeof action.payload.label !== 'undefined' | ||
? action.payload.label | ||
: 'Prompt'; | ||
state.value = | ||
typeof action.payload.value !== 'undefined' | ||
? action.payload.value | ||
: 'prompt'; | ||
}, | ||
}, | ||
}); | ||
|
||
export const {changeDefault} = slice.actions; | ||
export const fetchDefault = (state: RootState) => state.camera; | ||
|
||
export default slice.reducer; | ||
|
||
export type CameraState = { | ||
label: 'Device' | 'AR' | 'Prompt'; | ||
value: 'device' | 'ar' | 'prompt'; | ||
}; | ||
|
||
type CameraLoad = { | ||
payload: { | ||
label: 'Device' | 'AR' | 'Prompt'; | ||
value: 'device' | 'ar' | 'prompt'; | ||
}; | ||
}; |
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
Oops, something went wrong.