-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRSVM.swift
36 lines (22 loc) · 981 Bytes
/
RSVM.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import SwiftUI
@MainActor
public class RSVM: ObservableObject {
public init(){}
@Published public var playlist: Playlist = Playlist()
public func createAndSaveList() {
Task(priority: .medium) {
let reqRes = RequestResponse()
let baseURL = URL(string: "https://www.orourkeheavyindustries.com")
let playlistUrlString = "/api/addplaylist"
guard let playlistUrl = URL(string:playlistUrlString, relativeTo: baseURL) else { return }
do {
playlist = try await reqRes.postData(codable: Playlist.self, encode: playlist, url: playlistUrl)
} catch {
var debugDescription: String {
return "Error Desc: \(error)"
}
playlist.description = debugDescription
} // end catch
}
}
}