You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
548 B
20 lines
548 B
/**
|
|
* 求职进度 hook:拉取求职进度时间轴,统一管理 loading / error / refresh。
|
|
*/
|
|
import { useCallback } from 'react';
|
|
import { fetchJobProgress } from '../api';
|
|
import type { JobProgress } from '../types';
|
|
import { useAsyncData } from './useAsyncData';
|
|
|
|
export function useJobProgress() {
|
|
const fetcher = useCallback(() => fetchJobProgress(), []);
|
|
|
|
const { data, loading, error, refresh } = useAsyncData(fetcher);
|
|
|
|
return {
|
|
progress: (data as JobProgress | null) ?? null,
|
|
loading,
|
|
error,
|
|
refresh,
|
|
};
|
|
}
|
|
|