open-nomad/ui/tests/utils/set-policy.js
2022-01-26 12:06:18 -05:00

10 lines
327 B
JavaScript

export default function setPolicy(policy) {
const { id: policyId } = server.create('policy', policy);
const clientToken = server.create('token', { type: 'client' });
clientToken.policyIds = [policyId];
clientToken.save();
window.localStorage.clear();
window.localStorage.nomadTokenSecret = clientToken.secretId;
}