sleepyRias / BetterSteam

just some CS students exploring development
0 stars 0 forks source link

Framework: Use Axios Library #2

Closed rhaetscher closed 1 year ago

rhaetscher commented 1 year ago

... and extract the GET logic into its own files:

SteamRepository.ts // -> describes WHAT functions exist ( getGames(): Array ) SteamRepositoryAxios.ts // -> is a class that implements SteamRepository that uses axios

If you are unsure how it is done, look it up in our RA-MICRO Web Repo

rhaetscher commented 1 year ago

@Multi538 du kannst das hier auch schon machen, indem du Platzhalter-URLS etc. nutzt und in der "SteamRepositoryAxios" class die Mockliste zurückgibst.

// in App.vue z.B.
const axios = new AxiosInstance()
const repo = new SteamRepositoryAxios(axios)

loadGames() {
repo.loadGames()
}

// in SteamRepositoryAxios
import { MockGames }from "src/mockdata.ts"
....
loadGames() {
return Promise.resolve(MockGames )
}