Help me fox eslint error - promises must be awaited
Help me fix this error
Error: Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator. @typescript-eslint/no-floating-promises
Error: Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator. @typescript-eslint/no-floating-promises
I have this code
import { useEffect } from "react";
import useUserStore from "~/store/useUserStore";
import supabase from "~/utils/supabaseClient";
const useAuthorized = () => {
const userStore = useUserStore();
useEffect(() => {
const checkAuthorization = async () => {
try {
const response = await supabase.auth.getUser();
if (response.data.user) {
userStore.setIsAuthenticatedTrue();
userStore.setUserId(response.data.user?.id);
const { data } = await supabase.from("users")
.select("profile_picture_url")
.eq("userId", userStore.userId)
if (data) {
userStore.setProfilePictureUrl(data[0]?.profile_picture_url as string);
}
}
} catch (error) {
console.error("checkAuthorization - " , error)
}
}
checkAuthorization();
}, []);
};
export default useAuthorized;
import { useEffect } from "react";
import useUserStore from "~/store/useUserStore";
import supabase from "~/utils/supabaseClient";
const useAuthorized = () => {
const userStore = useUserStore();
useEffect(() => {
const checkAuthorization = async () => {
try {
const response = await supabase.auth.getUser();
if (response.data.user) {
userStore.setIsAuthenticatedTrue();
userStore.setUserId(response.data.user?.id);
const { data } = await supabase.from("users")
.select("profile_picture_url")
.eq("userId", userStore.userId)
if (data) {
userStore.setProfilePictureUrl(data[0]?.profile_picture_url as string);