Giter Club home page Giter Club logo

strapiswift's People

Contributors

ricardorauber avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

xrofa reggievick

strapiswift's Issues

Offline persistence

Any idea on how to add offline persistence or offline syncing support to an app that uses Strapi? Something that Firestore etc. provide?

Unable to use the upload

On my Strapi I have the default User (from "user-permissions"), and I have on it a field called "picture".
Using the upload I'm doing something like this:

                contentType: "user",
                id: 1,
                field: "picture",
                image: profilePicture,
                compressionQuality: 90) { response in

                guard let record = response.dictionaryValue() else {
                    return
                }
                print("Some data: \(record)")
            }```
            
But I keep having a 500 error even if I let an unauthenticated user try to upload something.
What am I doing wrong here? Thanks

Connection Refused When Using StrapiSwift

Summary

Having issues using this library to connect to my local Strapi instance

I noticed when I make requests with other frameworks that it is /api/tests instead /tests. Should the StrapiSwift library be adding a prefix of /api? Or am I doing something else wrong here?

Server Error

[2022-06-13 13:29:21.686] http: POST /tests (4 ms) 405

Swift error

2022-06-13 13:30:30.612046-0400 APPNAME[9756:3200131] [connection] nw_socket_handle_socket_event [C5.1:2] Socket SO_ERROR [61: Connection refused]

Collection Schema

{
  "kind": "collectionType",
  "collectionName": "tests",
  "info": {
    "singularName": "test",
    "pluralName": "tests",
    "displayName": "Test"
  },
  "options": {
    "draftAndPublish": true
  },
  "pluginOptions": {},
  "attributes": {
    "name": {
      "type": "string"
    }
  }
}

Code

import Foundation
import Combine
import FirebaseAuth
import StrapiSwift

class StrapiService: StrapiAPI {
    
    private let strapi = Strapi(scheme: .http, host: "localhost", port: 1337)
    
    func createScorecard(courseName: String) {
        let request = CreateRequest(
            contentType: "test",
            parameters: [
                "name": courseName,
            ]
        )
        
        strapi.exec(request: request) { response in
            if let error = response.error {
                // There was a connection failure
                print(error)
                return
            }
            if let error = response.strapiError() {
                // Oh no, something went wrong with your data :(
                print(error)
                return
            }
            
            guard let record = response.dictionaryValue(),
                let id = record["id"] as? Int
                else {
                    //print(response)
                    return
            }
            print("STRAPI: Created record with id: \(id)")
        }
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.