-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GetAuthenticatedUser in Dashboard (#19142)
* [dashboard] remove unused service mock * [dashboard] use `GetAuthenticatedUser` instead of `getLoggedInUser` * fixup: override workspaceAutostartOptions also fix toDurationString call * fixup: move `isOnboardingUser` to dashboard * fixup: move getProfile from protocol to common * fixup fromWorkspaceAutostartOption * move getPrimaryEmail to common and clean up * rm getProfile from protocol, use ProfileDetails * fixup missing leeway dependencies * fix getPrimaryEmail * fix resetting workspace timeout * [gitpod-db] remove dependency to `@gitpod/public-api-common` * cleanup BUILD.yaml
- Loading branch information
1 parent
0152b84
commit e4ccbf0
Showing
58 changed files
with
954 additions
and
1,091 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
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
23 changes: 23 additions & 0 deletions
23
components/dashboard/src/data/current-user/authenticated-user-query.ts
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,23 @@ | ||
/** | ||
* Copyright (c) 2023 Gitpod GmbH. All rights reserved. | ||
* Licensed under the GNU Affero General Public License (AGPL). | ||
* See License.AGPL.txt in the project root for license information. | ||
*/ | ||
|
||
import { useQuery } from "@tanstack/react-query"; | ||
import { userClient } from "../../service/public-api"; | ||
import { GetAuthenticatedUserRequest, User } from "@gitpod/public-api/lib/gitpod/v1/user_pb"; | ||
|
||
export const useAuthenticatedUser = () => { | ||
const query = useQuery<User>({ | ||
queryKey: getAuthenticatedUserQueryKey(), | ||
queryFn: async () => { | ||
const params = new GetAuthenticatedUserRequest(); | ||
const response = await userClient.getAuthenticatedUser(params); | ||
return response.user!; | ||
}, | ||
}); | ||
return query; | ||
}; | ||
|
||
export const getAuthenticatedUserQueryKey = () => ["authenticated-user", {}]; |
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.