// HandleRequest handles the link token get request
func (g GetLinkTokenInfo) HandleRequest(vars map[string]string) (interface{}, error) {
	var loginInfo LoginTokenInfo
	var err error
	if loginInfo, err = ParseLoginToken(g.Token); err != nil {
		return nil, err
	}
	var response getLinkTokenInfoResponse
	response.LinkTokens, err = dbapi.GetLinkTokens(loginInfo.FamilyID)
	return response, err
}
Exemple #2
0
// HandleRequest deletes a link token
func (d DeleteLinkToken) HandleRequest(vars map[string]string) (interface{}, error) {
	var loginInfo LoginTokenInfo
	var err error
	if loginInfo, err = ParseLoginToken(d.Token); err != nil {
		return nil, err
	}

	if err = dbapi.DeleteLinkToken(loginInfo.FamilyID, d.LinkToken); err != nil {
		return nil, err
	}

	var response deleteLinkTokenResponse
	response.LinkTokens, err = dbapi.GetLinkTokens(loginInfo.FamilyID)
	return response, err
}