arnaucube
arnaucube/decentralized-blogging-platformPublic Self-hosted repository
decentralized-blogging-platform/webapp/views/profile/profile.js
webapp/views/profile/profile.jsRaw
 1'use strict';
 2
 3angular.module('app.profile', ['ngRoute'])
 4
 5    .config(['$routeProvider', function($routeProvider) {
 6        $routeProvider.when('/profile', {
 7            templateUrl: 'views/profile/profile.html',
 8            controller: 'ProfileCtrl'
 9        });
10    }])
11
12    .controller('ProfileCtrl', function($scope, $rootScope, $http) {
13
14        $http.get(clienturl + 'user')
15            .then(function(data) {
16                console.log('data success');
17                console.log(data);
18                $scope.user = data.data;
19                localStorage.setItem("ai_user", JSON.stringify($scope.user));
20
21            }, function(data) {
22                console.log('no user');
23            });
24    });