コード例 #1
0
        /// <inheritdoc />
        public async Task <bool> Login(LoginModel model)
        {
            var pathParams = new HttpPathParameters();

            pathParams.Add("login", -1);

            var settings = new HttpSettings(Url, null, pathParams, "Login");

            var body = new HttpBody <LoginModel>(model);

            var user = await _httpService.CreateWithResult <StorageUser, LoginModel>(settings, body);

            if (user == null)
            {
                return(false);
            }

            await _localStorageService.SetItemAsync("user", user);

            await _localStorageService.SetItemAsync("token", user.Token);

            _storeService.Add("user", user);
            return(true);
        }