soapbox/docs/store.md

104 wiersze
2.7 KiB
Markdown
Czysty Zwykły widok Historia

2020-04-18 22:06:51 +00:00
# Redux Store Map
A big part of what makes soapbox-fe function is the [Redux](https://redux.js.org/) store.
Redux is basically a database of everything your frontend needs to know about in the form of a giant JSON object.
To work with Redux, you will want to install the [Redux browser extension](https://extension.remotedev.io/).
This will allow you to see the full Redux store when working in development.
Due to the large size of the Redux store in soapbox-fe, it's worth documenting the purpose of each path.
If it's not documented, it's because I inherited it from Mastodon and I don't know what it does yet.
- `dropdown_menu`
- `timelines`
- `meta` - User-specific data that is _not_ a frontend setting (see: `settings`).
- `pleroma` - Pleroma specific metadata about the user pulled from `/api/v1/accounts/verify_credentials` (excluding the pleroma_settings_store)
- `alerts`
- `loadingBar` - Managed by [react-redux-loading-bar](https://github.com/mironov/react-redux-loading-bar)
- `modal`
- `user_lists`
- `domain_lists`
- `status_lists`
- `accounts` - Data for all accounts you've viewed since launching the page, so they don't have to be downloaded twice.
- `accounts_counters`
- `statuses` - Data for all statuses you've viewed since launching the page, so they don't have to be downloaded twice.
- `relationships`
- `settings` - Any frontend configuration values that should be persisted to the backend database. This includes user preferences as well as metadata such as emoji usage counters. It uses [`pleroma_settings_store`](https://docs-develop.pleroma.social/backend/API/differences_in_mastoapi_responses/#accounts) to do it if it's available. If there's some other endpoint that handles your value, it doesn't belong here.
- `push_notifications`
- `mutes`
- `reports`
- `contexts`
- `compose`
- `search`
- `media_attachments`
- `notifications`
- `height_cache`
- `custom_emojis`
- `identity_proofs`
- `lists`
- `listEditor`
- `listAdder`
- `filters`
- `conversations`
- `suggestions`
- `polls`
- `trends`
- `groups`
- `group_relationships`
- `group_lists`
- `group_editor`
- `sidebar`
- `patron` - Data related to [soapbox-patron](https://gitlab.com/soapbox-pub/soapbox-patron)
2020-04-26 04:27:02 +00:00
- `soapbox` - Soapbox specific configuration pulled from `/instance/soapbox.json`. The configuration file isn't required and this map can be empty.
2020-04-18 22:06:51 +00:00
- `instance` - Instance data pulled from `/api/v1/instance`
- `me` - The account ID of the currently logged in user, 'null' if loading, and 'false' if no user is logged in.
- `auth` - Data used for authentication
- `app` - Map containing the app used to make app requests such as register/login and its access token.
- `user` - Map containing the access token of the logged in user.