小编Dan*_*ark的帖子

API 调用在邮递员上返回,但在调用并登录浏览器时返回 500 内部服务器错误

这与 Laravel 5.4 及其 Passport 密码授予有关。

\n\n

我有获取 access_token 供用户使用的路线,效果完全正常。

\n\n

如果当前访问令牌过期,我还有一个刷新令牌的路线。

\n\n

当我使用 Postman 到达路线时

\n\n
http://192.168.10.10/refresh\n
Run Code Online (Sandbox Code Playgroud)\n\n

我得到这个有效的返回:

\n\n
"data": {\n    "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOi...deleting most of it.",\n    "expires_in": 600\n}\n
Run Code Online (Sandbox Code Playgroud)\n\n

但是,当我通过浏览器点击路由时,通过以下代码使用 axios:

\n\n
let  headers = { \'Content-type\': \'application/json\' }\nreturn axios.post("http://192.168.10.10/refresh", {headers: headers}).then(res => {\n    if (res) return res;\n        }).catch(err => {\n            if (err) return err.response;\n        });\n
Run Code Online (Sandbox Code Playgroud)\n\n

我收到 HTTP 500 错误状态代码。

\n\n

我也在跟踪 laravel 日志中的错误,这是堆栈跟踪。

\n\n

[2017-08-30 07:21:41] local.ERROR:GuzzleHttp\\Exception\\ClientException:客户端错误:POST http://192.168.10.10/oauth/token导致400 Bad Request响应:\n{"error":"invalid_request","message":"请求缺少必需的参数,包括无效的参数值,(被截断...)\n 在 /home/vagrant/Code/work/vendorgraphs-api/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113 …

php passport.js laravel-5

5
推荐指数
1
解决办法
4万
查看次数

在Vue JS中使用v-for为组件设置道具

我有一个PhoneCard.vue组件,我正试图传递道具.

<template>
    <div class='phone-number-card'>
        <div class='number-card-header'>
            <h4 class="number-card-header-text">{{ cardData.phone_number }}</h4>
            <span class="number-card-subheader">
                {{ cardData.username }}
            </span>
        </div>
    </div>
</template>

<script>
export default {
    props: ['userData'],
    components: {
    },
    data() {
        return {
            cardData: {}
        }
    },
    methods: {
        setCardData() {
            this.cardData = this.userData;
            console.log(this.cardData);
        }
    },
    watch: {
        userData() {
            this.setCardData();
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

组件接收userData的属性,然后将其设置为组件的cardData属性.

我有另一个Vue.js组件,我将其用作页面.在这个页面上,我正在向api发出一个AJAX调用,以获取一个数字和用户列表.

import PhoneCard from './../../global/PhoneCard.vue';
export default {
    components: {
        'phone-card': PhoneCard
    },
    data() {
        return {
            phoneNumbers: [],
        }
    },
    methods: {
        fetchActiveNumbers() { …
Run Code Online (Sandbox Code Playgroud)

javascript vue-component vuejs2

2
推荐指数
1
解决办法
6699
查看次数

在Visual Studio Code中格式化组件属性的下一行

有什么方法可以设置VS代码格式化程序来格式化Angular 2+模板中的组件,以将属性换行。我希望它是这种格式:

  <app 
    [input1]="input1$ | async" 
    [input2]="input2$ | async" 
    (inputChanged)="setInput(input)">
  </app>
Run Code Online (Sandbox Code Playgroud)

对我们来说,启用自动格式化并以这种方式格式化将是很好的。React在下一行中包装JSX属性并对齐它们具有类似的功能。

html visual-studio-code angular

2
推荐指数
1
解决办法
390
查看次数