0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Steinを使って名前マスタから情報を取得するメモ

Posted at

名前の登録があれば設定、なければ登録を促す処理
ユーザIDをもとにユーザ名を取り出す処理。

function getUserName(userId){
    let userName ; 
    userName = store.read("name_master", { search: { user_id: userId } }).then(data => {
        console.log(data);
        let uName;
        console.log(data.length);
        if(data.length === 0 ){
            uName = "";
        }else{
            uName = data[0].user_name;
        }
        console.log(uName);
        //1行しか取れないので1つ目のユーザ名を指定
        return uName;
    
    });
    return userName;
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?