Skip to content

Instantly share code, notes, and snippets.

View blogui91's full-sized avatar
🎯
Focusing

Cesar Santana blogui91

🎯
Focusing
  • Doorvel
  • Monterrey
  • 19:06 (UTC -06:00)
View GitHub Profile
import routes from 'routes'
import Axios from 'axios'
export const Client = {
find(client_id) {
var client_promise = new Promise((resolve, reject) => {
axios.get(routes.RESOURCE_URL + client_id, (data) => {
resolve(data);
})
.catch((err) => {
import Service from 'easy-requests'
class Client extends Service
{
constructor(){
super();
}
}
import Service from 'easy-requests'
class Client extends Service
{
constructor(){
super();
this.config.endpoint = 'my-clients'
//this.config.origin = 'https://myapi.com'
//this.config.prefix = 'admin'
}
}
import Service from 'easy-requests'
export class Client extends Service {
constructor() {
super();
}
static deactivate() {
let ClientService = new Client();
@blogui91
blogui91 / CORS.php
Created June 13, 2017 00:35 — forked from fhferreira/CORS.php
Try to create - Cors Filter Laravel 5 Middleware
<?php namespace App\Http\Middleware;
use Closure;
use Illuminate\Contracts\Routing\Middleware;
use Illuminate\Http\Response;
class CORS implements Middleware {
/**
* Handle an incoming request.
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
import Client from 'services/Client.service'
let myClients
let client_promise = Client.get();
client_promise.then(response =>{
myClients = response
})
.catch(error => {
console.log("error: ", error)
import Validator from 'laravalidator-js'
let data = {
email: "Cesar.23@@santana.com", //Wrong
fullname: "Cesar A",
age: "16",
};
let rules = {
fullname: ['required'],
import Validator from 'laravalidator-js'
export class ClientValidator extends Validator
{
constructor(data) {
super()
this.rules = {
fullname: ['required'],
email: ['email'],
import ClientValidator from 'validators/Client.validator'
let clientData = {
fullname : 'Cesar Santana',
email : 'example@@email.com', //Wrong
age : 'asdf' //Wrong
}
let validation = ClientValidator.make(clientData)