0

从昨晚开始,我无法使用我的应用登录 Backand.com。服务器响应:

“加载资源失败:服务器响应状态为 405(不允许方法)

消息是:

错误 (0,0)“请求的资源不支持 http 方法 'GET'。”

我使用 angularbknd-sdk 版本 1.8.6 和 ionic 1.2.4。以下是我的代码的必要部分:controllers.js

angular.module('app.controllers', [])    
.controller('loginCtrl', function ($scope, $state, $rootScope, $timeout, LoginService, Backand) {

    $scope.signin = function () {
        LoginService.signin(this.email, this.password)
        .then(function () {
        }, showError);
    };

    function showError(error) {
        alert(error && error.data || error.error_description || 'Unknown error from server');
    };
})

服务.js

angular.module('app.services', [])
.service('LoginService', function (Backand, $rootScope, $state, $http, $q, localStorageService) {
    var service = this;

    service.signin = function (email, password) {
        //call Backand for sign in
        return Backand.signin(email, password).then(
            function () {
                onLogin();
            }
        );
    };

    service.signUp = function (firstName, lastName, eMail, pw, pwRepeat) {
        return Backand.signup(firstName, lastName, eMail, pw, pwRepeat)
            .then(function (signUpResponse) {
                var request = $http({
                    method: 'GET',
                    url: Backand.getApiUrl() + '/1/objects/users',
                    params: {
                        search: eMail
                    }
                }).then(function (response) {
                    localStorageService.set('userID', response.data.data[0].id);
                    return onLogin();
                }, function errorCallback(response) {
                    console.log(response);
                });
            })
    };

    service.signout = function () {
        return Backand.signout();
    };

    service.CheckLogin = function () {
        if (Backand.getToken() === undefined || Backand.getToken() != null) {
            onLogin();
        }
    };

    function onLogin() {
        $rootScope.$broadcast('authorized');
        $state.go('menu.home');
        return true;
    };
})

登录.html

<ion-view style="" id="page8" title="Login">
    <ion-content class="padding has-header">
        <div class="bar bar-subheader">
            <h1 style="color: rgb(0, 0, 0);" id="home-heading1">Willkommen zum runTracking!</h1>
            <div style="color: rgb(0, 0, 0);" id="home-markdown2">
                <p>Bitte melde dich an, um die App nutzen zu können.</p>
            </div>
            <form ng-submit="signin()">
                <div class="list">
                    <label class="item item-input">
                        <input id="email" name="email" type="email" placeholder="E-Mail Adresse" ng-model="email">
                    </label>
                    <label class="item item-input">
                        <input id="password" name="password" type="password" placeholder="Passwort" ng-model="password">
                    </label>
                </div>
                <div class="padding">
                    <button class="button button-block button-positive" type="submit">
                        Login
                    </button>
                </div>
                <span><a ui-sref="signUp">Registrieren</a></span>
            </form>
        </div>
    </ion-content>
</ion-view>

错误在哪里?

4

1 回答 1

0

我自己解决了这个问题。我不知道为什么,但是在我从设备中删除该应用程序并再次重新安装该应用程序后,一切正常。

于 2016-05-09T18:49:11.910 回答