mirror of
https://github.com/formbricks/formbricks.git
synced 2026-01-06 05:40:02 -06:00
* feat: add deletes account button on profile section. * feat: add delete account action when user click on delete account button * feat:logout user when his account is deleted * feat: added warning message before user deletes account * feat: add description to Delete account section * fix: fix: build issue. * fix: avoid giving the ownership of a team to a member who is not an admin * fix: merge conflict * fix: use !== in delete button disabled prop * fix: typo semething -> Something * refactor: simplified user deletion logic * refactor: explain user deletion logic * refactor: remove unecessary delete membership queries * feat: add deletes account button on profile section. * feat: add delete account action when user click on delete account button * feat:logout user when his account is deleted * feat: added warning message before user deletes account * fix merge conlicts * update to delete info text * feat: delete the team if the owner deletes his account and the team has no admins * add await
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
export const fetchRessource = async (url: string) => {
|
|
const res = await fetch(url);
|
|
|
|
// If the status code is not in the range 200-299,
|
|
// we still try to parse and throw it.
|
|
if (!res.ok) {
|
|
const error: any = new Error("An error occurred while fetching the data.");
|
|
// Attach extra info to the error object.
|
|
error.info = await res.json();
|
|
error.status = res.status;
|
|
throw error;
|
|
}
|
|
|
|
return res.json();
|
|
};
|
|
|
|
export const fetcher = async (url: string) => {
|
|
const res = await fetch(url);
|
|
|
|
// If the status code is not in the range 200-299,
|
|
// we still try to parse and throw it.
|
|
if (!res.ok) {
|
|
const error: any = new Error("An error occurred while fetching the data.");
|
|
// Attach extra info to the error object.
|
|
error.info = await res.json();
|
|
error.status = res.status;
|
|
throw error;
|
|
}
|
|
|
|
return res.json();
|
|
};
|
|
|
|
export const updateRessource = async (url: string, { arg }: { arg: any }) => {
|
|
return fetch(url, {
|
|
method: "PUT",
|
|
headers: { "Content-Type": "application/json" },
|
|
body: JSON.stringify(arg),
|
|
});
|
|
};
|