UNPKG

955 BJavaScriptView Raw
1import angular from 'angular';
2
3import {storiesOf} from '@storybook/html';
4
5import AuthNG from '../auth-ng/auth-ng';
6import angularDecorator, {APP_NAME} from '../../.storybook/angular-decorator';
7import hubConfig from '../../.storybook/hub-config';
8
9
10storiesOf('Legacy Angular|Auth Ng', module).
11 addParameters({
12 notes: 'Provides an Angular wrapper for Auth.',
13 hermione: {skip: true}
14 }).
15 addDecorator(angularDecorator()).
16 add('authorization', () => {
17 angular.module(APP_NAME, [AuthNG]).
18 config(['authProvider', function provider(authProvider) {
19 authProvider.config(hubConfig);
20 }]).
21 controller('testCtrl', function controller(auth, $q) {
22 $q.resolve(auth.requestUser()).
23 then(user => {
24 this.user = user;
25 });
26 });
27
28 return `
29 <div ng-controller="testCtrl as ctrl">
30 <h3>User info</h3>
31 <pre>{{ ctrl.user | json }}</pre>
32 </div>
33 `;
34 });