import { create } from 'zustand' import axios from 'axios' type AuthState = { credential?: { username: string, password: string }; verify: (username: string, password: string) => Promise } export default create(set => ({ verify: async (username: string, password: string): Promise => { try { const res = await axios.get("https://api.feedbin.com/v2/authentication.json", { auth: { username, password } }) console.log("verifying") if (res.status > 299) return false set({ credential: { username, password } }) return true } catch(e) { console.log(e) return false } } }))