-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add url and user inside data tree (#240)
* Add url and user inside data tree * Cleanup * change key to URL * add email and username instead of name
- Loading branch information
Showing
13 changed files
with
167 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
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,33 @@ | ||
import { createReducer } from "utils/AppsmithUtils"; | ||
import { ReduxActionTypes, ReduxAction } from "constants/ReduxActionConstants"; | ||
import { User } from "constants/userConstants"; | ||
|
||
export type AuthUserState = { | ||
username: string; | ||
email: string; | ||
id: string; | ||
role: string; | ||
}; | ||
|
||
const initialState: AuthUserState = { | ||
username: "", | ||
email: "", | ||
id: "", | ||
role: "", | ||
}; | ||
|
||
const authUserReducer = createReducer(initialState, { | ||
[ReduxActionTypes.FETCH_USER_DETAILS_SUCCESS]: ( | ||
state: AuthUserState, | ||
action: ReduxAction<User>, | ||
) => { | ||
return { | ||
...state, | ||
username: action.payload.username, | ||
email: action.payload.email, | ||
id: action.payload.id, | ||
}; | ||
}, | ||
}); | ||
|
||
export default authUserReducer; |
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,35 @@ | ||
import { createReducer } from "utils/AppsmithUtils"; | ||
import { ReduxActionTypes, ReduxAction } from "constants/ReduxActionConstants"; | ||
|
||
export type UrlDataState = { | ||
queryParams: Record<string, string>; | ||
protocol: string; | ||
host: string; | ||
hostname: string; | ||
port: string; | ||
pathname: string; | ||
hash: string; | ||
href: string; | ||
}; | ||
|
||
const initialState: UrlDataState = { | ||
queryParams: {}, | ||
protocol: "", | ||
host: "", | ||
hostname: "", | ||
port: "", | ||
pathname: "", | ||
hash: "", | ||
href: "", | ||
}; | ||
|
||
const urlReducer = createReducer(initialState, { | ||
[ReduxActionTypes.SET_URL_DATA]: ( | ||
state: UrlDataState, | ||
action: ReduxAction<UrlDataState>, | ||
) => { | ||
return action.payload; | ||
}, | ||
}); | ||
|
||
export default urlReducer; |
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
Oops, something went wrong.