Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: add user/settings page for managing external auth#10945

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Emyrk merged 9 commits intomainfromexternal_auth_fe_updates
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
PR suggestions
  • Loading branch information
@Emyrk
Emyrk committedDec 5, 2023
commitad5587ab4b810407015db4597b6160b534dd4b2c
3 changes: 0 additions & 3 deletionssite/src/api/queries/externalauth.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,9 +27,6 @@ export const userExternalAuth = (providerID: string) => {
export const validateExternalAuth = (_: QueryClient) => {
return {
mutationFn: API.getExternalAuthProvider,
onSuccess: async () => {
// No invalidation needed.
},
};
};

Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -30,8 +30,6 @@ const UserExternalAuthSettingsPage: FC = () => {
...mutateParams,
onSuccess: async () => {
await mutateParams.onSuccess();
await refetch();
setUnlinked(unlinked + 1);
},
});

Expand All@@ -49,17 +47,14 @@ const UserExternalAuthSettingsPage: FC = () => {
}}
onValidateExternalAuth={async (providerID: string) => {
try {
await validateAppMutation.mutateAsync(providerID, {
onSuccess: (data) => {
if (data.authenticated) {
displaySuccess("Application link is valid.");
} else {
displayError(
"Application link is not valid. Please unlink the application and reauthenticate.",
);
}
},
});
const data = await validateAppMutation.mutateAsync(providerID);
if (data.authenticated) {
displaySuccess("Application link is valid.");
} else {
displayError(
"Application link is not valid. Please unlink the application and reauthenticate.",
);
}
} catch (e) {
displayError(
getErrorMessage(e, "Error validating application link."),
Expand All@@ -83,7 +78,14 @@ const UserExternalAuthSettingsPage: FC = () => {
onConfirm={async () => {
try {
await unlinkAppMutation.mutateAsync(appToUnlink!);
// setAppToUnlink closes the modal
setAppToUnlink(undefined);
// refetch repopulates the external auth data
await refetch();
// this tells our child components to refetch their data
// as at least 1 provider was unlinked.
setUnlinked(unlinked + 1);

displaySuccess("Successfully unlinked the oauth2 application.");
} catch (e) {
displayError(getErrorMessage(e, "Error unlinking application."));
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp