Comments (9)
所有的请求都走 fetcher , fetcher 里面加个 then 用来做拦截就行。
from amis.
感觉这个需求是个伪需求, 理由如下:
- 对于无权限的菜单, 不显示 ( 在实操中, 菜单是由后台根据权限列出来的 )
- 对于无权限的按钮, 不显示 , 或置灰.
- 对于无权限的数据, 完全是后台控制, 前台根本没有控制权
所以, 貌似在 " 正常操作 " 流程下, 并不会涉及到 " 需要跳转到 无权限页面 " 这种操作 ?
所以我们考虑 " 非正常操作":
如果用户通过浏览器地址栏 , 跳转到某个前台路由, 而这个路由是没有权限访问的
这时, 我们有两种策略:
- 用户可以看到页面, 但由于数据权限控制在后台, 因此他进入页面可能会看到空白界面 + 越权提示, 也无法保存
- 控制 react router 的路由, 当出现 越权访问时, 重定向到 403 页面.
考虑前端路由并不安全, 所以本质上, 方式2 与 方式1是一回事, 只是用户体验更好.
对于一般的 企业内部应用, 感觉第一种策略就够用了, 实际使用中也基本不会遇到问题.
不知是否正确?
from amis.
如果服务端更新权限,接口会返回403错误码或其他形式,此时就需要提示用户进行重新登录之类的操作。所以,拦截,或者说过滤器是很必要的。
from amis.
所有的请求都走 fetcher , fetcher 里面加个 then 用来做拦截就行。
你好,是在App.tsx里添加then么?
如果不是的话,能否告知是在哪里添加呢?或者有没有一个demo可以参考,amis-admin这个demo里,没有找到类似的写法
from amis.
在这 补个 then 就可以了 https://github.com/fex-team/amis-admin/blob/master/App.tsx#L44
from amis.
在这 补个 then 就可以了 https://github.com/fex-team/amis-admin/blob/master/App.tsx#L44
from amis.
jssdk 怎么实现啊?
from amis.
jssdk 怎么实现啊?
同问
from amis.
jssdk 怎么实现啊?
有结果了吗,同问
from amis.
Related Issues (20)
- 菜单栏展开后子菜单出现从左到右的滑动效果,如何关闭
- Inputtable children后,填入数据总是自动收起。是不支持,树录入数据吗? HOT 1
- 3.6.3中的crud组件使用时,switch开关操作请求接口,点击分页后,id发生错位
- 建议mapping多个参数映射时候增加类似select得maxTagCount属性
- [email protected]在react@18+的concurrent模式下,出现报错问题 HOT 1
- mobx版本太低
- amis-editor-demo 启动报错 Module not found: Error: Can't resolve 'ts-loader'
- input-table组件节点嵌套的children属性所属父节点上没有显示折叠按钮,折叠按钮显示在根节点了
- websocket优化
- amis样式打包问题 HOT 1
- Calendar如何监控切换月份事件?
- crud支持某些行不展示勾选框
- Combo InputGroup 组件联动不生效
- tpl组件内通过写原生html和js如何实现将链接转换二维码来展示 HOT 6
- 下拉菜单,使用接口获取下拉菜单选项后,为select增加事件时,无法打开 事件编辑框
- ombo组件删除的同时,修改指定行的数据,但修改没有任何效果 HOT 1
- 怎么实现一个按钮根据返回结果跳转到不同的url
- 弹窗独立以后,在左侧大纲树进行弹窗内容配置时无法选择全局上下文 HOT 1
- bug: crud 列里面有 quickEdit mode: 'inline', name 为 a[0].bb 数组时候 导致switch 按钮不受控。 HOT 1
- Date 日期时间组件的updateFrequency不支持使用数据映射,报错Moment Timezone has no data for ${ }
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amis.