amis icon indicating copy to clipboard operation
amis copied to clipboard

如何使用 seesionStronge

Open manguanghui opened this issue 5 years ago • 2 comments

实现场景:

登录验证

存在的问题:

如何将后台返回的数据存入 SeeionStronge 或者 LocalStronge ,在需要进行接口验证的时候,取出来让后端进行验证

当前方案:

现在的方式后台获取请求头里的token,得到的是token这个字符串,而不是token对应的数据

code here...

{ "type": "crud", "name": "sample", "data": { "token": "${ls:token}" }, "api": { "method": "get", "url": "http://localhost:7000/api/v1/select_alladmin", "headers": { "token": "token" } },

manguanghui avatar Jul 16 '21 06:07 manguanghui

推荐你直接修改fetcher把请求参数附加上 https://baidu.gitee.io/amis/zh-CN/docs/start/getting-started#%E6%8E%A7%E5%88%B6-amis-%E7%9A%84%E8%A1%8C%E4%B8%BA 里面可以修改fetcher 渲染页面前 先请求用户Token 然后在fetcher里面把Token加上就好了

502647092 avatar Jul 20 '21 07:07 502647092

用 ss:token

nwind avatar Oct 11 '21 05:10 nwind