export const setUserInfo = (user:Object)=>{
    if(localStorage.getItem('userInfo')){
        localStorage.removeItem('userInfo')
        localStorage.setItem('userInfo',JSON.stringify(user))
     }else{
        localStorage.setItem('userInfo',JSON.stringify(user))
     }
}

export const getUserInfo = ()=>{
    if(localStorage.getItem('userInfo')){
      return localStorage.getItem('userInfo')
     }else{
       return {}
     }
}


export const setUid = (uid:string)=>{
  if(localStorage.getItem('uid')){
      localStorage.removeItem('uid')
      localStorage.setItem('uid',JSON.stringify(uid))
   }else{
      localStorage.setItem('uid',JSON.stringify(uid))
   }
}

export const getUid = ()=>{
  if(localStorage.getItem('uid')){
    return localStorage.getItem('uid')
   }else{
     return {}
   }
}


export const onSetRouter = (user:Object)=>{
  if(localStorage.getItem('router')){
      localStorage.removeItem('router')
      localStorage.setItem('router',JSON.stringify(user))
   }else{
      localStorage.setItem('router',JSON.stringify(user))
   }
}

export const onGetRouter = ()=>{
  if(localStorage.getItem('router')){
    return localStorage.getItem('router')
   }else{
     return {}
   }
}


