项目地址
dbt
airflow
一、错误处理
1.1 普通弹窗处理
1. baseapi
- baseApi.ts里通过对response的判断,来决定是否
- 通过switch判断,普通错误使用toast组件,显示在页面的右下角
const customBaseQuery = fetchBaseQuery({
baseUrl: 'https://localhost:5001/api'
});
type ErrorResponse = | string | {
title: string
} | {
errors: string[]
};
const sleep = () =>
new Promise(resolve =>
setTimeout(resolve, 1000));
export const baseQueryWithErrorHandling = async (args: string | FetchArgs, api: BaseQueryApi,
extraOptions: object) =>
{
api.dispatch(startLoading());
await sleep();
const result = await customBaseQuery(args, api, extraOptions);
api.dispatch(stopLoading());
if (result.error) {
console