What do you want to save?
Add Code snippet
New code examples
-
Html 2022-03-27 11:20:29
toggle dark mode javascript
<style> body { background-color: white; color: black; } /* DARK MODE */ .dark-mode{ background-color: black; color: white; } </style> <button class="nav-item"><a role="button" onclick="darkmode()... Add solution -
Javascript 2022-03-03 08:10:01
angular local storage
function createItem() { localStorage.setItem('nameOfItem', 'value'); } createItem() // Creates a item named 'nameOfItem' and stores a value of 'value' function getValue() { return localStorage.getItem('nameOfItem'); } // Gets the value of 'nameOfIt... Add solution -
Other 2022-03-03 07:20:05
how to refresh idToken in Cognito
var refreshToken = localStorage.getItem("refreshToken"); var token = new AmazonCognitoIdentity.CognitoRefreshToken({ RefreshToken: refreshToken }) cognitoUser.refreshSession(token, function (err, session) { console.log(err, session); var... Add solution -
Other 2022-03-02 16:35:02
apollo client set headers on each request
import { ApolloClient, HttpLink, ApolloLink, InMemoryCache, concat } from '@apollo/client'; const httpLink = new HttpLink({ uri: '/graphql' }); const authMiddleware = new ApolloLink((operation, forward) => { // add the authorization to the headers ... Add solution -
Javascript 2022-02-28 11:15:03
send token in axios header
import axios from "axios"; const httpClient = axios.create({ baseURL: "http://youradress", // baseURL: process.env.APP_API_BASE_URL, }); httpClient.interceptors.request.use(function (config) { const token = localStora... Add solution -
TypeScript 2022-02-02 08:16:43
how to store objects in localstorage
var testObject = { 'one': 1, 'two': 2, 'three': 3 }; // Put the object into storage localStorage.setItem('testObject', JSON.stringify(testObject)); // Retrieve the object from storage var retrievedObject = localStorage.getItem('testObject'); console.lo... Add solution
Best helpers
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5