Created
December 29, 2017 10:36
-
-
Save ManishLSN/a0c0bd76aea0f31c0b1ff46678497d88 to your computer and use it in GitHub Desktop.
set header in angular js application
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//$window.location.reload(); | |
//$state.go("login"); | |
$cookies.put("token", response.token); | |
var value = $cookies.get("token"); | |
/* $cookies.put("loginUserId", response[0].id); | |
$rootScope.loginUserId = $cookies.get("loginUserId"); */ | |
localStorageService.set("loginUserId", response.id); | |
$rootScope.loginUserId = localStorageService.get('loginUserId'); | |
localStorageService.set("isSuperAdmin", response.isSuperAdmin); | |
$rootScope.isSuperAdmin = localStorageService.get('isSuperAdmin'); | |
/* $cookies.put("isSuperAdmin", response[0].isSuperAdmin); | |
$rootScope.isSuperAdmin = $cookies.get("isSuperAdmin"); */ | |
$http.defaults.headers.common.Authorization = response.token; | |
if(response.isSuperAdmin == '3') | |
$state.go("header.fre_order"); | |
else | |
$state.go("home.dashboard"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment