Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for actions API #121

Open
BryceRussell opened this issue May 31, 2024 · 1 comment
Open

Add support for actions API #121

BryceRussell opened this issue May 31, 2024 · 1 comment
Labels
enhancement New feature or request todo Goal for next major release

Comments

@BryceRussell
Copy link
Member

Add support for the new experimental actions API from Astro

Things to consider:

  • This is an experimental feature. For now, this should only be enabled if an author defines an entrypoint
  • This only works with SSR, ATP needs to warn users that a project is SSG and not SSR or Hybrid
@BryceRussell BryceRussell added enhancement New feature or request todo Goal for next major release labels May 31, 2024
@BryceRussell BryceRussell self-assigned this May 31, 2024
@BryceRussell
Copy link
Member Author

Blocked until support for injecting actions is added: https://github.com/withastro/roadmap/blob/actions/proposals/0046-actions.md#integration-actions

Current recommendation is to export an action from the theme package for users to configure themselves

// package/actions.ts
import { defineAction, z } from 'astro:actions';

export const someActions = () => {
	like: defineAction({
		// ...
	})
}
// project/src/actions/index.ts
import { defineAction, z } from 'astro:actions';
import { someActions } from 'my-theme/actions';

export const server = {
  ...someActions()
};

@BryceRussell BryceRussell removed their assignment May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request todo Goal for next major release
Projects
Development

No branches or pull requests

1 participant