Created
April 3, 2020 09:29
-
-
Save sonbyungjun/3ce810a365bb79ccfdc33bf1a5b4a826 to your computer and use it in GitHub Desktop.
로직 클래스화 예제 코드
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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