@@ -2,6 +2,7 @@ import type Express from "express";
22import { Router } from "express" ;
33import { config } from "../../lib/config" ;
44import { getFileSystemRepo } from "../../lib/get-file-system-repo" ;
5+ import { getQiitaApiInstance } from "../../lib/get-qiita-api-instance" ;
56import { itemsShowPath } from "../../lib/qiita-cli-url" ;
67import { validateItem } from "../../lib/validators/item-validator" ;
78import type {
@@ -79,8 +80,7 @@ const itemsShow = async (req: Express.Request, res: Express.Response) => {
7980 // const { data, itemPath, modified, published } = ;
8081 const { itemPath, modified, published } = item ;
8182
82- const { accessToken } = await config . getCredential ( ) ;
83- const qiitaApi = new QiitaApi ( { token : accessToken } ) ;
83+ const qiitaApi = await getQiitaApiInstance ( ) ;
8484 const renderedBody = await qiitaApi . preview ( item . rawBody ) ;
8585
8686 const currentUser = await getCurrentUser ( ) ;
@@ -139,8 +139,7 @@ const itemsUpdate = async (req: Express.Request, res: Express.Response) => {
139139 return ;
140140 }
141141
142- const { accessToken } = await config . getCredential ( ) ;
143- const qiitaApi = new QiitaApi ( { token : accessToken } ) ;
142+ const qiitaApi = await getQiitaApiInstance ( ) ;
144143 let output : { [ key : string ] : string | boolean } = {
145144 success : true ,
146145 uuid : result . id || "" ,
0 commit comments