-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathdeleteChannel.js
41 lines (39 loc) · 1.16 KB
/
deleteChannel.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { API, Auth } from 'aws-amplify'
import * as mutations from './graphql/mutations';
import * as chimeApi from './chimeapi/chime'
export default async function DeleteChannel(props) {
let ret = true;
const user = await Auth.currentAuthenticatedUser()
const token = user.signInUserSession.idToken.jwtToken
const authid = user.attributes.sub;
const chatChannel = props.chatChannel;
console.log("in delete");
console.log(authid);
console.log(chatChannel);
const param = {
arn : props.id,
}
const requestData = {
headers: {
Authorization: token
},
queryStringParameters: param,
}
try {
const data = await API.post('ivsdelete', '/', requestData);
console.log(data);
const target = {
id: props.id,
}
await chimeApi.deleteChannel(chatChannel, authid);
let reply = await API.graphql({ query: mutations.deleteChannel, variables: { input: target } });
console.log(reply);
return ret;
}
catch (e) {
console.log("ERROR!!!");
console.log(e);
ret = false;
return ret;
}
}