mirror of
https://github.com/open-webui/open-webui
synced 2024-11-08 09:39:55 +00:00
24 lines
477 B
TypeScript
24 lines
477 B
TypeScript
|
import { WEBUI_API_BASE_URL } from '$lib/constants';
|
||
|
|
||
|
export const getGravatarUrl = async (email: string) => {
|
||
|
let error = null;
|
||
|
|
||
|
const res = await fetch(`${WEBUI_API_BASE_URL}/utils/gravatar?email=${email}`, {
|
||
|
method: 'GET',
|
||
|
headers: {
|
||
|
'Content-Type': 'application/json'
|
||
|
}
|
||
|
})
|
||
|
.then(async (res) => {
|
||
|
if (!res.ok) throw await res.json();
|
||
|
return res.json();
|
||
|
})
|
||
|
.catch((err) => {
|
||
|
console.log(err);
|
||
|
error = err;
|
||
|
return null;
|
||
|
});
|
||
|
|
||
|
return res;
|
||
|
};
|