MCPcopy Create free account
hub / github.com/OpenAtomFoundation/SmartIDE / getServerMenu

Function getServerMenu

cli/cmd/connect.go:137–164  ·  view source on GitHub ↗
(auth model.Auth)

Source from the content-addressed store, hash-verified

135}
136
137func getServerMenu(auth model.Auth) error {
138 url := fmt.Sprint(auth.LoginUrl, "/api/menu/getMenu")
139 headers := map[string]string{
140 "Content-Type": "application/json",
141 }
142 if auth.Token != nil {
143 headers["x-token"] = auth.Token.(string)
144 }
145 headers["x-user-id"] = "1"
146 httpClient := common.CreateHttpClientEnableRetry()
147 response, err := httpClient.PostJson(url, make(map[string]interface{}), headers)
148 if err != nil {
149 return err
150 }
151 if response == "" {
152 return errors.New("服务器返回空!")
153 }
154
155 l := &apiResponse.DefaultResponse{}
156 err = json.Unmarshal([]byte(response), l)
157 if err != nil {
158 return err
159 }
160 if l.Code != 0 {
161 return errors.New(l.Msg)
162 }
163 return nil
164}
165
166// 已经连接的工作区id 列表
167var connectedWorkspaceIds []string = []string{}

Callers 1

checkLoginFunction · 0.85

Calls 1

PostJsonMethod · 0.80

Tested by

no test coverage detected