Skip to content

Instantly share code, notes, and snippets.

View diasjuniorr's full-sized avatar
🏠
Working from home

Dias Junior diasjuniorr

🏠
Working from home
View GitHub Profile
const PericiaList = () => {
const navigate = useNavigate();
const [isLoading, setIsLoading] = useState(true);
const [pericias, setPericias] = useState([] as PericiaWithCarAndCostumer[]);
const [periciasFiltered, setPericiasFiltered] = useState(
[] as PericiaWithCarAndCostumer[]
);
const periciasFilterContext = useContext(
PericiasFilterContext
) as PericiasFilterContextProps;
import { serve } from "https://deno.land/std@0.177.0/http/server.ts";
import { corsHeaders } from "../_shared/cors.ts";
import { USER_ROLES } from "../_shared/roles.ts";
import {
throwCustomError,
throwInternalCustomError,
handleErrorResponse,
} from "../_shared/customError.ts";
import { UNAUTHORIZED_ERROR, USER_NOT_FOUND_ERROR, newMissingParametersError } from "../_shared/errors.ts";
import { createNewSupabaseClient } from "../_shared/client.ts";
serve(async (req: Request): Promise<Response> => {
if (req.method === "OPTIONS") {
return new Response("ok", { headers: corsHeaders });
}
return await handleRequest(req);
});
const handleRequest = async (req: Request): Promise<Response> => {
try {