Skip to content

Commit

Permalink
fix: use authenticated client for delete account (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
Clement-Muth authored Oct 27, 2024
1 parent 5994e2b commit 655059d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
13 changes: 0 additions & 13 deletions .env.development

This file was deleted.

4 changes: 2 additions & 2 deletions src/applications/Profile/Api/deleteAccount.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use server";

import { HTTPError } from "ky";
import { pcomparatorApiClient } from "~/clients/PcomparatorApiClient";
import { pcomparatorAuthenticatedApiClient } from "~/clients/PcomparatorApiClient";
import { auth } from "~/libraries/nextauth/authConfig";

/**
Expand All @@ -20,7 +20,7 @@ export const deleteAccount = async (): Promise<void> => {
if (!session?.user?.id) throw new Error("User not authenticated");

try {
await pcomparatorApiClient.delete(`user/${session?.user?.id}/account/delete`).json();
await pcomparatorAuthenticatedApiClient.delete(`user/${session?.user?.id}/account/delete`).json();
} catch (err) {
if (err instanceof HTTPError) {
switch (err.response.status) {
Expand Down

0 comments on commit 655059d

Please sign in to comment.