Skip to content

Commit

Permalink
a bit better form
Browse files Browse the repository at this point in the history
  • Loading branch information
dadukhankevin committed Jul 5, 2023
1 parent a610aa0 commit fd761d6
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
5 changes: 4 additions & 1 deletion frontend/src/lib/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@
"success": "Success: your account has been updated",
"button_update": "Update account info",
"more_settings": "More Settings",
"delete_account": "Delete Account"
"delete_account": "Delete Account",
"delete_user": "delete account",
"delete_user_label": "Enter 'delete account' to delete your account.",
"keyphrase": "delete account"
},
"appbar": {
"app_name": "Language Depot"
Expand Down
26 changes: 26 additions & 0 deletions frontend/src/routes/(authenticated)/user/+page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import type {
$OpResult,
ChangeUserAccountDataMutation,
ChangeUserAccountDataInput,
DeleteUserByUserMutation,
DeleteUserByUserInput

} from '$lib/gql/types';
import { getClient, graphql } from '$lib/gql';
Expand Down Expand Up @@ -39,3 +41,27 @@ export async function _changeUserAccountData(input: ChangeUserAccountDataInput):
}
return result;
}
export async function _deleteUserByUser(input: DeleteUserByUserInput): $OpResult<DeleteUserByUserMutation> {
//language=GraphQL
const result = await getClient()
.mutation(
graphql(`
mutation DeleteUserByUser($input: DeleteUserByUserInput!) {
deleteUserByUser(input: $input) {
user {
id
}
errors {
... on Error {
message
}
}
}
}
`),
{ input: input },
//invalidates the graphql user cache, but who knows
{ additionalTypenames: ['Users'] },
);
return result;
}

0 comments on commit fd761d6

Please sign in to comment.