refactor: rename var

This commit is contained in:
purocean
2022-01-11 16:47:35 +08:00
parent 9633993c75
commit cd773d52c0
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -33,7 +33,7 @@ const fileContent = async (ctx: any, next: any) => {
hash: await file.hash(ctx.query.repo, ctx.query.path)
})
} else if (ctx.method === 'POST') {
const oldHash = ctx.request.body.old_hash
const { oldHash } = ctx.request.body
if (!oldHash) {
throw new Error('No hash.')
+1 -1
View File
@@ -99,7 +99,7 @@ export async function writeFile (file: Doc, content = '') {
const result = await fetchHttp('/api/file', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ repo, path, content, old_hash: contentHash })
body: JSON.stringify({ repo, path, content, oldHash: contentHash, asBase64 })
})
return { hash: result.data }