Skip to content

Instantly share code, notes, and snippets.

@amorfati0310
Last active December 6, 2019 13:10
Show Gist options
  • Save amorfati0310/3aef76d415f35f149240b5fed7634b6f to your computer and use it in GitHub Desktop.
Save amorfati0310/3aef76d415f35f149240b5fed7634b6f to your computer and use it in GitHub Desktop.
temp1206.js
async function clickHandler() {
if (content === 'empty' || content === 'addDone') modalOff();
else if (nickname === '') switchContent('empty');
else if (content === 'add') {
switchContent('addDone');
await sendFriendRequestFunc({
variables: { id: testId, nickname },
});
} else if (content === 'delete') {
switchContent('deleteDone');
await deleteFriendFunc({ variables: { id: testId, nickname } });
setRefresh(true);
} else if (content === 'deleteDone') {
modalOff();
}
async function clickHandler() {
try {
switch case(content){
case empty: {
return modalOff();
}
case addDone: {
return modalOff();
}
case add: {
switchContent('addDone');
await sendFriendRequestFunc({
variables: { id: testId, nickname },
});
case delete: {
switchContent('deleteDone');
await deleteFriendFunc({ variables: { id: testId, nickname } });
setRefresh(true);
},
case deleteDone: {
modalOff();
}
default: break;
}
}
catch(e){
console.error(e);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment