# shadowfax-http

> Event handler for shadowfax forms that posts data to a gandalf server

Latest version **0.1.0** (published 2014-10-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install shadowfax-http
pnpm add shadowfax-http
yarn add shadowfax-http
bun add shadowfax-http
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2014-10-07 |
| First published | 2014-10-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Kai Davenport |
| Maintainers | binocarlos |
| Keywords | authentication, angular, form, login, register |

## Links

- npm: https://www.npmjs.com/package/shadowfax-http
- Repository: https://github.com/binocarlos/shadowfax-http
- Issues: https://github.com/binocarlos/shadowfax-http/issues
- npm.io page: https://npm.io/package/shadowfax-http

## Dependencies (2)

- [debug](https://npm.io/package/debug.md) ^2.0.0
- [angular-bsfy](https://npm.io/package/angular-bsfy.md) ^1.2.23-1

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.1.0 (latest) — 2014-10-07

## README

shadowfax-http
==============

Angular HTTP service for [shadowfax](https://github.com/binocarlos/shadowfax) login forms.

Connects to a REST based backend to perform login/register actions - [gandalf](https://github.com/binocarlos/gandalf) will work out of the box.

## install

Install the module to your project:

```
$ npm install binocarlos/shadowfax-http --save
```

## usage

Create a new handler by passing in a $scope that contain some shadowfax directives:

```js
var angular = require('angular-bsfy')
var shadowfax = require('shadowfax')
var shadowfaxhttp = require('shadowfax-http')

var app = angular.module('myApp',[
    shadowfax.name,
    shadowfaxhttp.name
])

.controller('LoginPage', function($scope, shadowfaxhttp){

	// listen to the shadowfax form events and dispatch
	// them to the given urls
	shadowfaxhttp($scope, {
		login:'/auth/login',
		register:'/auth/register'
	})

	// triggered if the user has logged in or registered with no problems
	$scope.$on('shadowfax:complete', function($ev, type){

		// type is a string 'login' or 'register'

		if(type=='login'){
			document.location = '/dashboard'
		}
		else{
			document.location = '/postregister'	
		}

	})

	// display a login error (like incorrect password)
	$scope.$on('shadowfax:error', function($ev, type, error){

		// type is 'login' or 'register' or 'save'

	})

	// display general information
	$scope.$on('shadowfax:message', function($ev, type, error){

		// type is 'login' or 'register' or 'save'

	})
})
```

## build

Then compile with [browserify](https://github.com/substack/node-browserify) and [brfs](https://github.com/substack/brfs):

```bash
$ browserify app.js > bundle.js
```

## license

MIT

---
_Source: https://npm.io/package/shadowfax-http · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
