Skip to content

Commit 9eefb01

Browse files
authored
Fix ZEIT deployments for overmind (codesandbox#2461)
* Fix ZEIT deployments for overmind * Remove then statements * Add typings
1 parent ad604d2 commit 9eefb01

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

packages/app/src/app/overmind/effects/zeit.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,14 @@ export default (() => {
6262
return nowData;
6363
},
6464
async getDeployments(name: string): Promise<ZeitDeployment[]> {
65-
const response = await axios.get<ZeitDeployment[]>(
65+
const response = await axios.get<{ deployments: ZeitDeployment[] }>(
6666
'https://api.zeit.co/v4/now/deployments',
6767
{
6868
headers: getDefaultHeaders(),
6969
}
7070
);
7171

72-
const deploysNoAlias = response.data
72+
const deploysNoAlias = response.data.deployments
7373
.filter(d => d.name === name)
7474
.sort((a, b) => (a.created < b.created ? 1 : -1));
7575

@@ -91,12 +91,16 @@ export default (() => {
9191
headers: getDefaultHeaders(),
9292
});
9393

94-
return response.data;
94+
return response.data.user;
9595
},
96-
async deleteDeployment(id: string) {
97-
return axios.delete(`https://api.zeit.co/v9/now/deployments/${id}`, {
98-
headers: getDefaultHeaders(),
99-
});
96+
async deleteDeployment(id: string): Promise<ZeitDeployment[]> {
97+
const response = await axios.delete(
98+
`https://api.zeit.co/v9/now/deployments/${id}`,
99+
{
100+
headers: getDefaultHeaders(),
101+
}
102+
);
103+
return response.data.deployments;
100104
},
101105
async deploy(contents: any, sandbox: Sandbox): Promise<string> {
102106
const apiData = await getApiData(contents, sandbox);
@@ -110,7 +114,7 @@ export default (() => {
110114
}
111115
);
112116

113-
return `https://${response.data.result.url}`;
117+
return `https://${response.data.url}`;
114118
},
115119
async aliasDeployment(id: string, zeitConfig: ZeitConfig): Promise<string> {
116120
const response = await axios.post(
@@ -121,7 +125,7 @@ export default (() => {
121125
}
122126
);
123127

124-
return `https://${response.data.result.alias}`;
128+
return `https://${response.data.alias}`;
125129
},
126130
};
127131
})();

packages/app/src/app/overmind/namespaces/files/actions.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,6 @@ export const filesUploaded: AsyncAction<{
285285
directoryShortid,
286286
});
287287
} catch (error) {
288-
console.error(error);
289288
if (error.message.indexOf('413') !== -1) {
290289
return;
291290
}

0 commit comments

Comments
 (0)