Skip to content

Instantly share code, notes, and snippets.

@sonbyungjun
Created April 3, 2020 09:29
Show Gist options
  • Save sonbyungjun/3ce810a365bb79ccfdc33bf1a5b4a826 to your computer and use it in GitHub Desktop.
Save sonbyungjun/3ce810a365bb79ccfdc33bf1a5b4a826 to your computer and use it in GitHub Desktop.
로직 클래스화 예제 코드
class Detail {
private link;
constructor(link) {
this.link = link;
}
public async detail(id: any): Promise {
return new Promise(async resolve => {
// 요청
let response = await Utils.BackEndAPI.get({
link: this.link,
})
// 오류: 원인 불명
if (response?.status != 200) {
if (response?.data?.message) {
Utils.pageNotification(response.data.message, 'is-danger')
resolve(undefined)
} else {
resolve(undefined)
}
return
}
if(response?.data?.notice){
let data = response.data.notice
resolve(data)
}else{
resolve(undefined)
}
})
}
}
const a = new Detail('link');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment