修复环境变量拖拽

This commit is contained in:
hanhh
2021-09-02 19:16:28 +08:00
parent 00cb915f48
commit 035c69898f
2 changed files with 33 additions and 41 deletions
+3 -3
View File
@@ -89,7 +89,7 @@ export default class EnvService {
fromIndex: number;
toIndex: number;
},
) {
): Promise<Env> {
let targetPosition: number;
const isUpward = fromIndex > toIndex;
const envs = await this.envs();
@@ -102,11 +102,11 @@ export default class EnvService {
? (envs[toIndex].position + envs[toIndex - 1].position) / 2
: (envs[toIndex].position + envs[toIndex + 1].position) / 2;
}
this.update({
const newDoc = await this.update({
_id,
position: targetPosition,
});
await this.set_envs();
return newDoc;
}
public async envs(