update
This commit is contained in:
@ -105,4 +105,26 @@ export default class Thirdparty {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
static async DeleteFile(url: string, field: any, token?: string) {
|
||||
try {
|
||||
const headers: Record<string, string> = {};
|
||||
if (token) {
|
||||
headers.Authorization = `Bearer ${token}`;
|
||||
}
|
||||
|
||||
const response = await axios.delete(url, { data: field, headers });
|
||||
const result = response.data;
|
||||
|
||||
if (!result.status) throw response;
|
||||
return result;
|
||||
} catch (error: any) {
|
||||
const { response } = error;
|
||||
throw {
|
||||
status: false,
|
||||
message: response?.data?.error ?? response?.data?.message ?? "Unknown error",
|
||||
data: null,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user