From a8430604f92c1f522447ccaec480599fcb74cf2f Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sat, 27 Dec 2025 23:09:52 +0800 Subject: [PATCH] :bug: Fix unsubscribed status cause subscription status loading infinitly --- lib/screens/posts/publisher_profile.dart | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/screens/posts/publisher_profile.dart b/lib/screens/posts/publisher_profile.dart index 2439ba90..78359cb2 100644 --- a/lib/screens/posts/publisher_profile.dart +++ b/lib/screens/posts/publisher_profile.dart @@ -1,3 +1,4 @@ +import 'package:dio/dio.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; @@ -371,9 +372,16 @@ Future publisherSubscriptionStatus( String pubName, ) async { final apiClient = ref.watch(apiClientProvider); - final resp = await apiClient.get("/sphere/publishers/$pubName/subscription"); - if (resp.statusCode == 200) { + try { + final resp = await apiClient.get( + "/sphere/publishers/$pubName/subscription", + ); return SnPublisherSubscription.fromJson(resp.data); + } catch (err) { + if (err is DioException) { + if (err.response?.statusCode == 404) return null; + rethrow; + } } return null; }