balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

Loginbutton.js (905B)


      1 import { useGlobalStore } from '../state/GlobalState'
      2 import { useUserStore } from '../state/User'
      3 import { __ } from '@wordpress/i18n'
      4 
      5 export default function LoginButton() {
      6     const apiKey = useUserStore(state => state.apiKey)
      7     if (apiKey.length === 0) {
      8         return <button
      9             type="button"
     10             className="components-button inline-block flex-1 text-center hover:bg-gray-100"
     11             onClick={() => useGlobalStore.setState({
     12                 currentPage: 'login',
     13             })}>
     14             {__('Log into account', 'extendify-sdk')}
     15         </button>
     16     }
     17 
     18     // This code currently won't render unless in DEVMODE
     19     return <button
     20         type="button"
     21         className="components-button inline-block flex-1 text-center hover:bg-gray-100"
     22         onClick={() => useUserStore.setState({
     23             apiKey: '',
     24         })}>{__('Log out', 'extendify-sdk')}</button>
     25 }