mirror of
https://github.com/writeas/writefreely-swiftui-multiplatform.git
synced 2024-11-15 01:11:02 +00:00
Clear user collections on logout
This commit is contained in:
parent
18ce54bd89
commit
21e8a4ca35
@ -79,6 +79,7 @@ private extension WriteFreelyModel {
|
||||
client = nil
|
||||
DispatchQueue.main.async {
|
||||
self.account.logout()
|
||||
self.collections.clearUserCollection()
|
||||
}
|
||||
} catch WFError.notFound {
|
||||
// The user token is invalid or doesn't exist, so it's been invalidated by the server. Proceed with
|
||||
@ -86,6 +87,7 @@ private extension WriteFreelyModel {
|
||||
client = nil
|
||||
DispatchQueue.main.async {
|
||||
self.account.logout()
|
||||
self.collections.clearUserCollection()
|
||||
}
|
||||
} catch {
|
||||
// We get a 'cannot parse response' (similar to what we were seeing in the Swift package) NSURLError here,
|
||||
|
@ -10,4 +10,9 @@ class CollectionListModel: ObservableObject {
|
||||
}
|
||||
collectionsList.append(contentsOf: self.userCollections)
|
||||
}
|
||||
|
||||
func clearUserCollection() {
|
||||
userCollections = []
|
||||
collectionsList = [ allPostsCollection, draftsCollection ]
|
||||
}
|
||||
}
|
||||
|
@ -7,12 +7,12 @@
|
||||
<key>WriteFreely-MultiPlatform (iOS).xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>0</integer>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
<key>WriteFreely-MultiPlatform (macOS).xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>1</integer>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
|
Loading…
Reference in New Issue
Block a user