fix(public-share): 404/410-Erkennung — ApiError.status statt err.response.status im Catch
This commit is contained in:
@@ -59,7 +59,10 @@ export function PublicSharePage() {
|
||||
})
|
||||
.catch((err: unknown) => {
|
||||
if (cancelled) return;
|
||||
const status = (err as { response?: { status?: number } })?.response?.status;
|
||||
// The API client's error interceptor rejects with an ApiError that
|
||||
// carries `.status` at the top level (not AxiosError.response.status).
|
||||
const e = err as { status?: number; response?: { status?: number } };
|
||||
const status = e?.status ?? e?.response?.status;
|
||||
if (status === 404) setState({ status: 'error', code: 'not_found' });
|
||||
else if (status === 410) setState({ status: 'error', code: 'expired' });
|
||||
else setState({ status: 'error', code: 'load_failed' });
|
||||
|
||||
Reference in New Issue
Block a user