How to use the api.get function in api

To help you get started, we’ve selected a few api examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github omohokcoj / motor-admin / ui / src / alerts / pages / show.vue View on Github external
loadQuery () {
      this.isLoadingQuery = true

      return api.get(`run_queries/${this.alert.query_id}`, {
      }).then((result) => {
        this.data = result.data.data
        this.columns = result.data.meta.columns
      }).catch((error) => {
        console.error(error)
      }).finally(() => {
        this.isLoadingQuery = false
      })
    }
  }
github omohokcoj / motor-admin / ui / src / tags / components / select.vue View on Github external
loadTags () {
      this.isLoading = true

      api.get('tags').then((result) => {
        this.tags = result.data.data
      }).catch((error) => {
        console.error(error)
      }).finally(() => {
        this.isLoading = false
      })
    }
  }
github raindropio / extensions / src / stores / bookmark.jsx View on Github external
onLoadId(id, callback) {
		if ((_state.item||{})._id == id)
			return;

		_state.item = {};
		_state.status = "loading";
		this.trigger(_state);

		Api.get("raindrop/"+id, (json)=>{
			if (json.result){
				_state.item = json.item;
				_state.status = "done";

				if (typeof callback == "function")
					callback(item);
			}
			else{
				_state.status = "error";

				if (typeof callback == "function")
					callback(false);
			}

			this.loadSuggestedTags().then(()=>this.trigger(_state))
		})
github taikongfeizhu / webpack-dll-demo / src / views / Content / index.js View on Github external
handleFetchData() {
    fetchAPI.get('/book/list/')
      .then((resp) => {
        const { status, data } = resp;
        if (status === 200) {
          this.setState({
            bookList: data.data
          });
        }
      });
  }
github omohokcoj / motor-admin / ui / src / reports / scripts / store.js View on Github external
function dashboardsRequest () {
  dashboardsRequestLock ||= api.get('dashboards', {
    params: {
      include: 'tags',
      fields: {
        dashboard: 'id,title,tags,updated_at',
        tags: 'id,name'
      }
    }
  }).finally(() => {
    dashboardsRequestLock = null
  })

  return dashboardsRequestLock
}
github instrumentisto / vue-app-example / src / api / users.ts View on Github external
public static login(email: string, password: string): Promise {
        return API.get('/users', {
            params: {
                email,
                password,
            },
        }).then((response: AxiosResponse) => {
            const users = response.data;

            if (users.length === 0) {
                return Promise.reject(1);
            }

            return users[0];
        });
    }
}