@@ -42,9 +42,7 @@ func GetClassTable(c *gin.Context) {
42
42
43
43
result , err := funnelServices .GetClassTable (user , postForm .Year , postForm .Term , loginType )
44
44
if err != nil {
45
- if err == apiException .NoThatPasswordOrWrong {
46
- userServices .DelPassword (user , loginType )
47
- }
45
+ userServices .DelPassword (err , user , loginType )
48
46
_ = c .AbortWithError (200 , err )
49
47
return
50
48
}
@@ -73,9 +71,7 @@ func GetScore(c *gin.Context) {
73
71
74
72
result , err := funnelServices .GetScore (user , postForm .Year , postForm .Term , loginType )
75
73
if err != nil {
76
- if err == apiException .NoThatPasswordOrWrong {
77
- userServices .DelPassword (user , loginType )
78
- }
74
+ userServices .DelPassword (err , user , loginType )
79
75
_ = c .AbortWithError (200 , err )
80
76
return
81
77
}
@@ -104,9 +100,7 @@ func GetMidTermScore(c *gin.Context) {
104
100
105
101
result , err := funnelServices .GetMidTermScore (user , postForm .Year , postForm .Term , loginType )
106
102
if err != nil {
107
- if err == apiException .NoThatPasswordOrWrong {
108
- userServices .DelPassword (user , loginType )
109
- }
103
+ userServices .DelPassword (err , user , loginType )
110
104
_ = c .AbortWithError (200 , err )
111
105
return
112
106
}
@@ -135,9 +129,7 @@ func GetExam(c *gin.Context) {
135
129
136
130
result , err := funnelServices .GetExam (user , postForm .Year , postForm .Term , loginType )
137
131
if err != nil {
138
- if err == apiException .NoThatPasswordOrWrong {
139
- userServices .DelPassword (user , loginType )
140
- }
132
+ userServices .DelPassword (err , user , loginType )
141
133
_ = c .AbortWithError (200 , err )
142
134
return
143
135
}
@@ -191,11 +183,7 @@ func GetRoom(c *gin.Context) {
191
183
192
184
result , err := funnelServices .GetRoom (user , postForm .Year , postForm .Term , postForm .Campus , postForm .Weekday , postForm .Week , postForm .Sections , loginType )
193
185
if err != nil {
194
- if err == apiException .NoThatPasswordOrWrong {
195
- userServices .DelPassword (user , loginType )
196
- _ = c .AbortWithError (200 , err )
197
- return
198
- }
186
+ userServices .DelPassword (err , user , loginType )
199
187
_ = c .AbortWithError (200 , err )
200
188
return
201
189
}
0 commit comments