//
//  APICallsView.swift
//  PadelClub
//
//  Created by Laurent Morvillier on 27/05/2024.
//

import SwiftUI
import LeStorage

struct APICallsListView: View {
    
    @State var collections: [String] = []
    
    var body: some View {
        
        List {
            ForEach(self.collections) { name in
                NavigationLink(name) {
                    APICallsView(text: Store.main.apiCallsFile(resourceName: name))
                }
            }
        }.onAppear {
            self.collections = Store.main.collectionNames()
        }
        
    }
}

struct APICallsView: View {
    
    var text: String
    
    var body: some View {
        List {
            Text(self.text).lineLimit(nil)
        }
    }
}

//#Preview {
//    APICallsListView()
//}
