PHP Classes

File: client/src/app/stores/CommonStore.ts

Recommend this page to a friend!
  Classes of mohammad anzawi   PHP Wallet API and Application   client/src/app/stores/CommonStore.ts   Download  
File: client/src/app/stores/CommonStore.ts
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: PHP Wallet API and Application
Application to manage a wallet by calling an API
Author: By
Last change:
Date: 2 years ago
Size: 715 bytes
 

Contents

Class file image Download
import {makeAutoObservable, reaction} from "mobx"; /** * check if token is set in browser */ export default class CommonStore { appLoaded: boolean = false token: string | null = window.localStorage.getItem('jwt') constructor() { makeAutoObservable(this) reaction( () => this.token, token => { if (token) { window.localStorage.setItem('jwt', token) } else { window.localStorage.removeItem('jwt') } } ) } setToken = (token: string | null) => { this.token = token; } setAppLoaded = () => { this.appLoaded = true; } }