export const getLocalToken = () => localStorage.getItem("token");

export const saveLocalToken = (token: string) => localStorage.setItem("token", token);

export const removeLocalToken = () => localStorage.removeItem("token");


import type { Ref } from "vue";

export const emailRules =  [
  (v:any) => /^[a-z.0-9]+@[a-z.-]+\.[a-z]+$/i.test(v) || 'Must be a valid e-mail.',
];

export const required = [
  (v:any) => !!v || 'This field is required.',
];

export const nameRules = [
  (v:any) => !!v || 'Name is required.',
];

export const password1Rules = [
    (v:any) => !!v || 'Password is required.',
    (v:any) => (v && v.length >= 8) || 'Password must be more than 8 characters',
];

export const usePassword2Rules = (password1:Ref<string>) => [
  (password2:string) => (password2 === password1.value) || 'Input same password.',
]