This file contains hidden or 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
let request = async (query: string): Promise<any[]> => { | |
const myHeaders = new Headers() | |
myHeaders.append('Ocp-Apim-Subscription-Key', 'b5deb0d4be5a4dcaaa478f7b343baa3d') | |
const params = { | |
q: query, | |
safeSearch: 'Strict', | |
license: 'Public' | |
} | |
const urlParams = new URLSearchParams((Object as any).entries(params)) // entries works in Chrome | |
const url = 'https://api.cognitive.microsoft.com/bing/v5.0/images/search?' + urlParams.toString() |
This file contains hidden or 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
interface IWaitForArgs { | |
test: () => boolean // run function only if test() returns true | |
interval: number | |
count: number // should be 0, required | |
maxAttempts: number // max number of attempts | |
run: () => any // function to run | |
} | |
function waitFor({test, interval, count, maxAttempts, run}: IWaitForArgs) { | |
// try to run function only maxAttempts times |
This file contains hidden or 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
import * as React from 'react' | |
import { storiesOf } from '@storybook/react' | |
import Progress from './progress' | |
storiesOf('Progress', module) | |
.add('Simple', () => ( | |
<div> | |
<div style={{width: 250}}> | |
<Progress percent={20} type="line"/> | |
</div> |
This file contains hidden or 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
import axios from 'axios'; | |
import { IUser } from '../types/index'; | |
let isRefreshing = false; | |
let refreshSubscribers: any = []; | |
export const API_VERSION = 'v1'; | |
export const BACKEND_API_URL = process.env.NODE_ENV === 'development' | |
? '//127.0.0.1:3000' | |
: process.env.REACT_APP_BACKEND_API_URL || `${window.location.protocol}//${window.location.hostname}`; |
OlderNewer