refac
This commit is contained in:
1 parent
5cc55e2278
commit
678c44c7cd
12 files changed
+268
-76
No files matched your search
@@ -712,3 +712,33 @@ export const deleteAPIKey = async (token: string) => {
|
||||
}
|
||||
return res;
|
||||
};
|
||||
|
||||
export const deleteOAuthSession = async (token: string, provider: string) => {
|
||||
let error = null;
|
||||
|
||||
const res = await fetch(
|
||||
`${WEBUI_API_BASE_URL}/auths/oauth/sessions/${encodeURIComponent(provider)}`,
|
||||
{
|
||||
method: 'DELETE',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${token}`
|
||||
}
|
||||
}
|
||||
)
|
||||
.then(async (res) => {
|
||||
if (!res.ok) throw await res.json();
|
||||
return res.json();
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
error = err.detail;
|
||||
return null;
|
||||
});
|
||||
|
||||
if (error) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
return res;
|
||||
};
|
||||
Reference in new issue
Block a user