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
import axios from 'axios' | |
import { BaseApi } from '@/api/baseApi' | |
export class AxiosApi extends BaseApi { | |
constructor() { | |
super() | |
} | |
async fetch(url: string): Promise<any> { | |
const { data } = await axios.get(`${this.baseUrl}${url}`) | |
return data |
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
import { BaseApi } from '@/api/baseApi' | |
import { FetchApi } from '@/api/fetchApi' | |
import { AxiosApi } from '@/api/axiosApi' | |
export class Api extends BaseApi { | |
private provider: any = new AxiosApi() | |
async fetch(url: string): Promise<any> { | |
return await this.provider.fetch(url) | |
} | |
} |
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
<template> | |
<div class="todo-list__row"> | |
<span>{{ todo.id }}: </span> | |
<span :class="{ 'todo-list__row--completed': todo.completed }">{{ | |
todo.title | |
}}</span> | |
</div> | |
</template> | |
<script lang="ts"> | |
import { Component, Vue, Prop } from 'vue-property-decorator' |
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
<template> | |
<div> | |
<Header listName="My new todo list" /> | |
<main> | |
<TodoList> | |
<TodoRow v-for="todo in todos" :key="todo.id" :todo="todo" /> | |
</TodoList> | |
</main> | |
</div> | |
</template> |
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
<template> | |
<div> | |
<Header listName="My new todo list" /> | |
<main> | |
<TodoList> | |
<!--<TodoCard--> | |
<!--v-for="{ id, title, completed } in todos"--> | |
<!--:key="id"--> | |
<!--:title="title"--> | |
<!--:completed="completed"--> |
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
import { BaseApi } from '@/api/baseApi' | |
import { FetchApi } from '@/api/fetchApi' | |
import { AxiosApi } from '@/api/axiosApi' | |
import { IApi } from '@/types' | |
export class Api extends BaseApi implements IApi { | |
private provider: any = new AxiosApi() | |
async fetch(url: string): Promise<any> { | |
return await this.provider.fetch(url) | |
} |
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
<template> | |
<div> | |
<Header listName="My new todo list" /> | |
<main> | |
<TodoList> | |
<TodoCard v-for="todo in todos" :key="todo.id" :todo="todo" /> | |
</TodoList> | |
</main> | |
</div> | |
</template> |
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
<template> | |
<div id="app"> | |
<div id="nav"> | |
<router-link to="/">Home</router-link> | | |
<router-link to="/about">About</router-link> | | |
<router-link to="/contacts">Contacts</router-link> | |
</div> | |
<router-view/> | |
</div> | |
</template> |
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
<template> | |
<div> | |
<h1>This is a home page</h1> | |
</div> | |
</template> | |
<script> | |
export default { | |
name: 'Home' | |
} |
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
<template> | |
<div> | |
<h1>This is an about page</h1> | |
</div> | |
</template> | |
<script> | |
export default { | |
name: 'About' | |
} |