|
@@ -162,6 +162,7 @@ func getUserRemoteAccessGws(w http.ResponseWriter, r *http.Request) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ reqFromMobile := r.URL.Query().Get("from_mobile") == "true"
|
|
if req.RemoteAccessClientID == "" && remoteAccessClientID == "" {
|
|
if req.RemoteAccessClientID == "" && remoteAccessClientID == "" {
|
|
logic.ReturnErrorResponse(w, r, logic.FormatError(errors.New("remote access client id cannot be empty"), "badrequest"))
|
|
logic.ReturnErrorResponse(w, r, logic.FormatError(errors.New("remote access client id cannot be empty"), "badrequest"))
|
|
return
|
|
return
|
|
@@ -288,6 +289,15 @@ func getUserRemoteAccessGws(w http.ResponseWriter, r *http.Request) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ if reqFromMobile {
|
|
|
|
+ // send resp in array format
|
|
|
|
+ userGwsArr := []models.UserRemoteGws{}
|
|
|
|
+ for _, userGwI := range userGws {
|
|
|
|
+ userGwsArr = append(userGwsArr, userGwI...)
|
|
|
|
+ }
|
|
|
|
+ logic.ReturnSuccessResponseWithJson(w, r, userGwsArr, "fetched gateways for user"+username)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
slog.Debug("returned user gws", "user", username, "gws", userGws)
|
|
slog.Debug("returned user gws", "user", username, "gws", userGws)
|
|
w.WriteHeader(http.StatusOK)
|
|
w.WriteHeader(http.StatusOK)
|
|
json.NewEncoder(w).Encode(userGws)
|
|
json.NewEncoder(w).Encode(userGws)
|