SHARE
TWEET

Untitled




Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- apiExample = ()=>{
- const API_URL = '/path';
- fetch(API_URL,{
- method:'post'
- headers: {
- 'content-type': 'application/json'
- },
- }).then(function(response){
- return response.json()
- }).then(data=>{
- if(data.code == '200'){
- // 200 處理邏輯
- }else{
- // 非 200 處理邏輯
- }
- }).catch(error=>{
- // error 處理邏輯
- })
- }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.