What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-09-10 12:40:03
casl react
import { AbilityBuilder } from '@casl/ability'; import React, { useState, useContext } from 'react'; import { AbilityContext } from './Can'; function updateAbility(ability, user) { const { can, rules } = new AbilityBuilder(); if (user.role === 'admi... Add solution -
Other 2021-09-10 05:55:02
error handling in fetch
function CheckError(response) { if (response.status >= 200 && response.status <= 299) { return response.json(); } else { throw Error(response.statusText); } } // Now call the function inside fetch promise resolver fetch(url) ... Add solution -
Other 2021-09-09 17:46:01
fetch api tutorial
fetch('https://api.github.com/users/manishmshiva', { method: "GET", headers: {"Content-type": "application/json;charset=UTF-8"} }) .then(response => response.json()) .then(json => console.log(json)); .catch(err =&... Add solution -
Javascript 2021-09-08 20:21:02
get an access token for microsoft graph api using javascript
const postData = { client_id: APP_ID, scope: MS_GRAPH_SCOPE, client_secret: APP_SECERET, grant_type: 'client_credentials' }; axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'; axios .post(TOKEN_ENDPOINT, qs.st... Add solution -
Javascript 2021-09-08 15:24:01
smtpjs attachment
<html> <script src="https://smtpjs.com/v3/smtp.js"></script> <input type="file" id="fileupload" onchange="uploadFileToServer()" /> <script> function uploadFileToServer() { var file = ... Add solution