-
Notifications
You must be signed in to change notification settings - Fork 16
feat: add mobx-strapi #209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
e4c2ae6
55f6d49
c21862b
81f0ab8
4395950
16e4ca1
2ff7afc
68d3da6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,9 @@ | ||
| import { User } from '@authing/native-js-ui-components'; | ||
| import { ListModel, Stream, toggle } from 'mobx-restful'; | ||
| import { Stream, toggle } from 'mobx-restful'; | ||
| import { StrapiListModel } from 'mobx-strapi'; | ||
|
|
||
| import { Base, createListStream, InputData, Media } from '../Base'; | ||
| import sessionStore from '../User/Session'; | ||
| import sessionStore, { strapiClient } from '../User/Session'; | ||
| import { Team } from './Team'; | ||
|
|
||
| export interface Award | ||
|
|
@@ -22,8 +23,8 @@ export interface AwardAssignment | |
| award: Award; | ||
| } | ||
|
|
||
| export class AwardModel extends Stream<Award>(ListModel) { | ||
| client = sessionStore.client; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 此处不要改动,已经配置好登录验证机制的 API 客户端就是放在这个 store 上的。
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这我也看不懂了
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
先说说你个人的理解。
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 原来25 26 行代码是否要改动? 我已经迷糊了。
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 现在遇到 类型“AwardModel”上不存在属性“baseURI 的报错
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
关于 client 的问题是我昏头了,你改为
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
参考:https://github.com/idea2app/MobX-RESTful/tree/main/wrapper/Strapi#modelarticlets |
||
| export class AwardModel extends StrapiListModel<Award> { | ||
| client = strapiClient; | ||
| currentAssignment?: AwardAssignmentModel; | ||
|
|
||
| constructor(baseURI: string) { | ||
|
|
@@ -55,8 +56,10 @@ export class AwardModel extends Stream<Award>(ListModel) { | |
| } | ||
| } | ||
|
|
||
| export class AwardAssignmentModel extends Stream<AwardAssignment>(ListModel) { | ||
| client = sessionStore.client; | ||
| export class AwardAssignmentModel extends Stream<AwardAssignment>( | ||
| StrapiListModel, | ||
| ) { | ||
| client = strapiClient; | ||
|
|
||
| constructor(baseURI: string) { | ||
| super(); | ||
|
|
||


Uh oh!
There was an error while loading. Please reload this page.