NextContent Idea
- [ ] Have a useCMS() wrapper for fetching content - using swr under the hood
SDK Proposal v2
Research Notes
Designs
https://www.figma.com/file/xAawYaHw1GcYw5KZmtt3Co/NextContent-Platform?node-id=102%3A748
Auth Ideas:
- Terminal command
nextcontent auth
to login
- Opens browser, user logs in then redirects with auth token to local server run by terminal
- Terminal server then passes auth to terminal to save in session or local storage
- Terminal command
nextcontent sync types
- Makes api call with saved auth token to pull nextcontent.d.ts to project root
Considerations
- Lookup and LookupMany functions will paginate by default. 50 lookup objects per page containing fields defined as lookup fields.
- Collection from lookupMany can be used straight away and will be updated as new matching results come in
- UseNextCMS method takes in:
- Optional pageSize property value but defaults to environment variable value or 50
- Optional endpointUrl property value but defaults to environment variable value
- Optional authToken property value but defaults to environment variable value
- Optional viewAs property value (userId) but defaults to “public”
- CommitChanges can be called in event handlers (such as button click) and will be async
- Object in collection or item from lookup/lookupMany methods will contain a
markDeleted()
method which will mark the object for deletion. This change will only apply once commitChanges()
is called.
- Object in collection will have a
toString()
override which automatically strips out fields marked as private
- Configuration (i.e. api endpoint, auth token, defaultPageSize, etc) will be set in the environment variables:
- NEXTCMS_ENDPOINT_URL
- NEXTCMS_AUTH_TOKEN
- NEXTCMS_DEFAULT_PAGE_SIZE