Hi,
Sorry for bothering you guys again, just a simple question is there any way to call a function in app side to change values in database ?
I am using vue js to make my application on the server side but I want to send in a link in email to the users to unsubscribe from a certain service or approve joining to a service. Is there some way to send the link so that when the user clicks they can automatically subscribe or unsubscribe from a service. I tried sending direct calls to the function but that does not work. Here is my api file :
<?php
namespace OCA\App\Controller;
use OCP\IRequest;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\Controller;
use OCA\App\Service\EorgService;
class EorgApiController extends ApiController {
/** @var NoteService */
private $service;
/** @var string */
private $userId;
use Errors;
public function __construct($appName,
IRequest $request,
EorgService $service,
$corsMethods = 'PUT, POST, GET, DELETE, PATCH',
$corsAllowedHeaders = 'Authorization, Content-Type, Accept',
$corsMaxAge = 1728000,
$userId) {
parent::__construct($appName, $request, $corsMethods, $corsAllowedHeaders, $corsMaxAge);
$this->service = $service;
$this->userId = $userId;
}
/**
* @NoAdminRequired
*/
public function index(): DataResponse {
return new DataResponse($this->service->findAll());
}
/**
* @NoAdminRequired
*/
public function show(int $id): DataResponse {
return $this->handleNotFound(function () use ($id) {
return $this->service->find($id);
});
}
public function index(): DataResponse {
return new DataResponse($this->service->findAll());
}
/**
* @NoAdminRequired
*/
public function show(int $id): DataResponse {
return $this->handleNotFound(function () use ($id) {
return $this->service->find($id);
});
}
/**
* @NoAdminRequired
*/
public function create(string $uid, string $email, string $organization, int $status): DataResponse {
return new DataResponse($this->service->create($uid, $email, $organization, $status));
}
/**
* @NoAdminRequired
*/
public function update(int $id, string $uid, string $email, string $organization, int $status): DataResponse {
return $this->handleNotFound(function () use ($id, $uid, $email, $organization) {
return $this->service->update($id, $uid, $email, $organization, $status);
});
}
public function updateOrg(int $id): DataResponse {
return $this->handleNotFound(function () use ($id) {
return $this->service->updateOrg($id);
});
}
public function deleteOrg(int $id): DataResponse {
return $this->handleNotFound(function () use ($id) {
return $this->service->deleteOrg($id);
});
}
Now the functions here for updateOrg and deleteOrg are the ones being called to change status in database and are both
POST functions
. Any idea how I can call them from a link ? As calling them will usually redirect them to default url and not show anything. Thank you