오윤석

character api 호출

...@@ -2,12 +2,29 @@ ...@@ -2,12 +2,29 @@
2 export let params = {}; 2 export let params = {};
3 3
4 import {push} from 'svelte-spa-router'; 4 import {push} from 'svelte-spa-router';
5 + import axios from 'axios';
6 +
7 + let character = {};
5 8
6 function init() { 9 function init() {
10 + let nickname;
11 +
7 if(!params.character) { 12 if(!params.character) {
8 M.toast({html:"캐릭터명을 입력해주세요."}); 13 M.toast({html:"캐릭터명을 입력해주세요."});
9 push("/"); 14 push("/");
10 } 15 }
16 +
17 + nickname = decodeURI(params.character);
18 +
19 + axios.get('/api/character', {
20 + params:{
21 + nickname:nickname
22 + }
23 + }).then(function(response) {
24 + console.log(response);
25 + }).catch(function(error) {
26 + console.log(error);
27 + });
11 } 28 }
12 29
13 init(); 30 init();
......